diff --git a/cookbook/security/voters_data_permission.rst b/cookbook/security/voters_data_permission.rst index 7e2db803b36..f6f52904f7a 100644 --- a/cookbook/security/voters_data_permission.rst +++ b/cookbook/security/voters_data_permission.rst @@ -204,20 +204,16 @@ from the security context is called. class PostController extends Controller { - public function showAction() + public function showAction($id) { // get a Post instance $post = ...; - + // keep in mind, this will call all registered security voters if (false === $this->get('security.context')->isGranted('view', $post)) { throw new AccessDeniedException('Unauthorised access!'); } - $product = $this->getDoctrine() - ->getRepository('AcmeStoreBundle:Post') - ->find($id); - return new Response('