Skip to content

Commit 11aead7

Browse files
Michael Kleinweaverryan
authored andcommitted
simplified the example
1 parent 8227270 commit 11aead7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cookbook/security/voters_data_permission.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,14 @@ from the security context is called.
192192
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
193193
use Symfony\Component\HttpFoundation\Response;
194194
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
195-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
196-
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
197-
use Acme\DemoBundle\Entity\Post;
198195
199196
class PostController extends Controller
200197
{
201-
/**
202-
* @Route("/blog/{id}")
203-
* @ParamConverter("post", class="SensioBlogBundle:Post")
204-
*/
205-
public function showAction(Post $post)
198+
public function showAction()
206199
{
200+
// get a Post instance
201+
$post = ...;
202+
207203
// keep in mind, this will call all registered security voters
208204
if (false === $this->get('security.context')->isGranted('view', $post)) {
209205
throw new AccessDeniedException('Unauthorised access!');

0 commit comments

Comments
 (0)