Skip to content

Commit

Permalink
minor #3856 Update voters_data_permission.rst (MarcomTeam)
Browse files Browse the repository at this point in the history
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 b32ec15
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cookbook/security/voters_data_permission.rst
Expand Up @@ -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>');
}
}
Expand Down

0 comments on commit b32ec15

Please sign in to comment.