Reputation: 31959
Is there a way to redirect using annotations?
/**
* Delete user
*
*
* @Route("/deleteUser/{user_id}", name="delete_user_from_id")
* @Template()
*/
public function deleteUserAction($user_id)
{
//....
return $this->redirect($this->generateUrl('acme_demo_homepage'));
}
Can we use annotations instead to avoid this extra line? Something like @redirect?
Upvotes: 2
Views: 2214
Reputation: 7448
Nope, it is not possible.
Have a look into FrameworkExtraBundle. A redirect must be triggered in a controller (often after some logic ;) )
Upvotes: 1