ecommerce121/util-bundle/Controller/ControllerBase.php line 463
{return $this->controllerUtil->getValidator();}protected function getEventDispatcher(): EventDispatcherInterface{return $this->controllerUtil->getEventDispatcher();}protected function dispatchEvent(string $eventName, ?object $event = null): void{$this->controllerUtil->getEventDispatcher()->dispatch($event, $eventName);}protected function getControllerUtil(): ControllerUtil{return $this->controllerUtil;}protected function getTokenStorage(): TokenStorageInterface{return $this->controllerUtil->getTokenStorage();}protected function getKernelRootDir(): string{return $this->controllerUtil->getKernelRootDir();}protected function getUploadsPath(): string{return $this->getKernelRootDir().'/publc/uploads/';}protected function jsonResult(array $data = []): JsonResponse{return $this->json(['hasError' => false,'result' => $data]);}protected function jsonError($message = '', $code = -1): JsonResponse{$data = ['hasError' => true,'error' => ['message' => $message,'code' => $code]];return $this->json($data);}public function denyAccessUnlessGranted(UserRoles|string|UserPermission $attribute, mixed $subject = null, string $message = 'Access Denied.'): void{$this->denyAccessUnlessGrantedCheck($attribute, $subject, $message);}protected function denyAccessUnlessGrantedCheck($attribute, $subject = null, string $message = 'Access Denied.'): void{if (!$this->isGranted($attribute, $subject)) {$exception = $this->createAccessDeniedException($message);$exception->setAttributes([$attribute]);$exception->setSubject($subject);throw $exception;}}public function getAdmin(): ?User{$user = $this->getUser();if (null === $user) {return null;}if (!($user instanceof User)) {throw new AuthenticationException('User must be of User type');}return $user;}protected function isGranted(string|UserRoles|UserPermission $attribute, mixed $subject = null): bool{return $this->getControllerUtil()->getAuthorizationChecker()->isGranted($attribute, $subject);}}