Skip to content

Commit

Permalink
minor #1315 Update PHP doc about annotations IsGranted (adpauly)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the main branch.

Discussion
----------

Update PHP doc about annotations IsGranted

The doc now suggests to use PHP attributes instead of "old" annotation for "IsGranted" instruction.
Sorry if my PR format doesn't match with your requirements. I just wanna help. :)

Commits
-------

81a39d8 Update PHP doc about annotations IsGranted
  • Loading branch information
javiereguiluz committed Feb 21, 2022
2 parents 05129f2 + 81a39d8 commit 6c1e93a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Controller/Admin/BlogController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function new(Request $request, EntityManagerInterface $entityManager): Re
public function show(Post $post): Response
{
// This security check can also be performed
// using an annotation: @IsGranted("show", subject="post", message="Posts can only be shown to their authors.")
// using a PHP attribute: #[IsGranted('show', subject: 'post', message: 'Posts can only be shown to their authors.')]
$this->denyAccessUnlessGranted(PostVoter::SHOW, $post, 'Posts can only be shown to their authors.');

return $this->render('admin/blog/show.html.twig', [
Expand Down

0 comments on commit 6c1e93a

Please sign in to comment.