I use Symfony 3 and I created my own Voter class.
I want to access it with @Security tag.
It kind of works.
If I do the following, this works fine:
public function getOrganisationAction($id, Request $request) {
But I do not like the idea of ββusing magic strings in the application, and I would prefer to use the class constant for checking.
Something like that:
public function getOrganisationAction($id, Request $request) {
But when I try to do this, I get the following error message:
Unexpected character \"\\\" around position 20 for expression 'is_granted(AppBundle\\OrgRoles::ROLE_ADMIN, id)'.
Which, when not abandoned, is as follows:
Unexpected character "\" around position 20 for expression 'is_granted(AppBundle\OrgRoles::ROLE_ADMIN, id)'.
So I'm confused.
It can be done?
Any suggestions on a better way to do this?
source share