30 días con LAST Stack
Componente Twig modal
  Start your All-Access Pass to unlock this challenge
Buy Access Login

Challenge 1 / 1

Your colleague asked you to help them fix an error they don't understand:

Error rendering "Alert" component: Expected argument of type "App\Entity\User", "string" given at property path "user".

The component looks like this:

namespace App\Twig\Components;

use App\Entity\User;
use Symfony\UX\TwigComponent\Attribute\AsTwigComponent;

#[AsTwigComponent]
class Alert
{
    public User $user;

    // ...
}

And it's rendered in Twig with:

<twig:Alert user="app.user" />

You, as an experienced Symfony developer, noticed the error immediately. How we could fix this?

Skip challenges and go to theNext Chapter

Turn Challenges Off?

All further challenges will be skipped automatically.
You can re-enable challenges at any time on this page or from your account page.