Permalink
Browse files

minor #3856 Update voters_data_permission.rst (MarcomTeam)

This PR was submitted for the 2.4 branch but it was merged into the 2.3 branch instead (closes #3856).

Discussion
----------

Update voters_data_permission.rst

Strange $product variable...

Commits
-------

a392e78 Update voters_data_permission.rst
a2d022b Update voters_data_permission.rst
  • Loading branch information...
weaverryan committed May 29, 2014
2 parents 9b7584f + 5794371 commit b32ec158602704de28325ca5ba5cd7a915d97af8
Showing with 2 additions and 6 deletions.
  1. +2 −6 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('<h1>'.$post->getName().'</h1>');
}
}

0 comments on commit b32ec15

Please sign in to comment.