I have an issue with my application, I have several routes declared on my controller which works properly but I have trouble with one of them.
I used the annotation system to declare the route of this method (like all my routes which works) like this :
/**
* Do something
*
* @Route("/synchro", name="app_synchro")
*/
public function synchroAction(Request $request){
//code here etc...
}
I checked it with the debug:router command so I know this route exists, I also tried to print $route and the value is good but when I made a redirection using :
return $this->redirectToRoute('app_synchro');
I encounter a 404 error.
Please, could someone help me to understand the origin of this issue ?
The proper way to redirect is to return it directly like so:
return $this->redirectToRoute('my_route_name');
What you are doing is returning the result code of redirecting...
$route= $this->redirectToRoute('my_route_name');
So $route contains the result of the redirect, which is NOT what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With