Closed
Description
Symfony version(s) affected: 5.2.3
sensio/framework-extra-bundle: 6.1.1
Description
Hi,
I have an error when use #[CurrentUser]:
Unable to guess how to get a Doctrine instance from the request information for parameter "user".
How to reproduce
<?php
namespace App\Controller\User;
use App\Entity\User;
use App\Repository\NotificationRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
class NotificationController extends AbstractController
{
#[Route('/notifications', name: 'user_notification_index', methods: ['GET'])]
public function index(#[CurrentUser] User $user): Response
{
...
}
}
Metadata
Metadata
Assignees
Labels
Issues and PRs which are looking for volunteers to complete them.Issues and PRs which are looking for volunteers to complete them.