- //Prevent non-admin to access here
- $this->denyAccessUnlessGranted('ROLE_ADMIN', null, $this->translator->trans('Unable to access this page without role %role%!', ['%role%' => $this->translator->trans('Admin')]));
-
- //Fetch doctrine
- #$doctrine = $this->getDoctrine();
-
- //Set section
- $section = $this->translator->trans('Calendar oauth form');
+ //Without admin role
+ if (!$this->checker->isGranted('ROLE_ADMIN')) {
+ //Throw 403
+ throw $this->createAccessDeniedException($this->translator->trans('Unable to access this page without role %role%!', ['%role%' => $this->translator->trans('Admin')]));
+ }