Custom message for @Security annotation
I'm trying to use @Security annotations for my routes. Like this: /** * @return Response * @Route("/action") * @Security("has_role('ROLE_USER')") * @Template() */ public function someAction() { return array(); } When the security restriction fires an exception, I get the message Expression "has_role('ROLE_USER')" denied access . This is not acceptable to be shown to the end user, so I'm trying to find a way to customize the message for annotation. Simple workaround is to not to use @Secutity annotations and write code like these: /** * @return Response * @Route("/action") * * @Template() */