Symfony 5.4, php7.4.
After removing sensio/framework-extra-bundle, as it is abandoned, all routes which contain ids returns an error message:
Cannot autowire argument $user of "App\Controller\Back\UserController::read()": it references class "App\Entity\User" but no such service exists.
Controller:
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/{id}", name="read", requirements={"id"="\d+"}, methods={"GET"})
*/
public function read(User $user): Response
{ return $this->render('back/user/read.html.twig', [
'user' => $user, ]);
}
My services.yaml:
services:
_defaults:
autowire: true
autoconfigure: true
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'
As it is stated here, this budnle included config for annotations and paramConverter, so I suppose my routes don't work now cause ids cannot be converted.
So should I install any other bundle instead sensio-extra-bundle to make my routes work or I need to change something in my annotations?
Thanks for help.