Skip to content

Commit 514482c

Browse files
committed
minor #18407 [Security] Update voters.rst (baptistepottier)
This PR was submitted for the 6.4 branch but it was merged into the 6.2 branch instead. Discussion ---------- [Security] Update voters.rst use constant of class and not string (in twig too) <!-- If your pull request fixes a BUG, use the oldest maintained branch that contains the bug (see https://symfony.com/releases for the list of maintained branches). If your pull request documents a NEW FEATURE, use the same Symfony branch where the feature was introduced (and `6.x` for features of unreleased versions). --> Commits ------- 1799a49 Update voters.rst
2 parents 16e475e + 1799a49 commit 514482c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security/voters.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ code like this:
105105
public function show(Post $post): Response
106106
{
107107
// check for "view" access: calls all voters
108-
$this->denyAccessUnlessGranted('view', $post);
108+
$this->denyAccessUnlessGranted('PostVoter::VIEW', $post);
109109
110110
// ...
111111
}
@@ -114,7 +114,7 @@ code like this:
114114
public function edit(Post $post): Response
115115
{
116116
// check for "edit" access: calls all voters
117-
$this->denyAccessUnlessGranted('edit', $post);
117+
$this->denyAccessUnlessGranted(PostVoter::EDIT, $post);
118118
119119
// ...
120120
}

0 commit comments

Comments
 (0)