Start your All-Access Pass to unlock this challenge
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?