Skip to content

Commit 651ee9a

Browse files
authored
[Voter] Use the subject's FQCN in the support method
People could replace only the `BlogPost` class. So the support method will always return `false`. With a leading `\`, the class name will resolve "normally"
1 parent 2664394 commit 651ee9a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Resources/skeleton/security/Voter.tpl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protected function supports($attribute, $subject)
1313
// replace with your own logic
1414
// https://symfony.com/doc/current/security/voters.html
1515
return in_array($attribute, ['POST_EDIT', 'POST_VIEW'])
16-
&& $subject instanceof App\Entity\BlogPost;
16+
&& $subject instanceof \App\Entity\BlogPost;
1717
}
1818

1919
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)

0 commit comments

Comments
 (0)