From 1a5a8064f3f8151eff6e526798e593d0c4217e2c Mon Sep 17 00:00:00 2001 From: Slobodan Date: Tue, 15 Sep 2015 18:08:23 +0300 Subject: [PATCH 1/2] service called on wrong variable --- cookbook/security/voters.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index 9a2a4c6a244..be32c3b874a 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -226,7 +226,7 @@ from the authorization checker is called. $authChecker = $this->get('security.authorization_checker'); - $this->denyAccessUnlessGranted('view', $post, 'Unauthorized access!'); + $authChecker->denyAccessUnlessGranted('view', $post, 'Unauthorized access!'); return new Response('

'.$post->getName().'

'); } From 095c25efd7b88cd053de7377abb6094b6e9555e4 Mon Sep 17 00:00:00 2001 From: Slobodan Stanic Date: Sun, 20 Sep 2015 14:43:59 +0300 Subject: [PATCH 2/2] removed service call from controller --- cookbook/security/voters.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/cookbook/security/voters.rst b/cookbook/security/voters.rst index 9a2a4c6a244..db56fb9af2e 100644 --- a/cookbook/security/voters.rst +++ b/cookbook/security/voters.rst @@ -224,8 +224,6 @@ from the authorization checker is called. // get a Post instance $post = ...; - $authChecker = $this->get('security.authorization_checker'); - $this->denyAccessUnlessGranted('view', $post, 'Unauthorized access!'); return new Response('

'.$post->getName().'

');