- //Prevent non-guest to access here
- $this->denyAccessUnlessGranted('ROLE_GUEST', null, $this->translator->trans('Unable to access this page without role %role%!', ['%role%' => $this->translator->trans('Guest')]));
+ //Without guest role
+ if (!$this->checker->isGranted('ROLE_GUEST')) {
+ //Throw 403
+ throw $this->createAccessDeniedException($this->translator->trans('Unable to access this page without role %role%!', ['%role%' => $this->translator->trans('Guest')]));
+ }