I upgraded my env from symfony 4.4 to 5.4, and after this I get now the following error:
The controller for URI "/" is not callable: Controller "FrameworkBundle:Redirect:redirect" does neither exist as service nor as class.
If I use other urls like /admin/dashboard it works all well.
I have this entry in my routes.yaml which seems to be the origin:
dwbn_login_target:
path: /
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: sonata_admin_dashboard
permanent: false # this for 301path: /
How would one achieve the FrameworkBundle:Redirect:redirect
in symfony 5?
CodePudding user response:
The preferred way in Symfony 5 is documented here:
https://symfony.com/doc/5.4/routing.html#redirecting-to-urls-and-routes-directly-from-a-route
In your case:
dwbn_login_target:
path: /
controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
defaults:
route: 'sonata_admin_dashboard'
permanent: false