diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index 9a2a4c6a244..44c666bbf42 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -224,9 +224,7 @@ from the authorization checker is called. // get a Post instance $post = ...; - $authChecker = $this->get('security.authorization_checker'); - - $this->denyAccessUnlessGranted('view', $post, 'Unauthorized access!'); + $authChecker->denyAccessUnlessGranted('view', $post, 'Unauthorized access!'); return new Response('