getDoctrine() ->getRepository($this->getEntityClass()) ->find($id); } /** * * @return string the complete fqdn of the class */ protected function getEntityClass(): string { return $this->crudConfig['class']; } /** * */ protected function onPostFetchEntity(string $action, Request $request, $entity, $_format): ?Response { return null; } /** * */ protected function onPostCheckACL(string $action, Request $request, $entity, $_format): ?Response { return null; } /** * check the acl. Called by every action. * * By default, check the role given by `getRoleFor` for the value given in * $entity. * * Throw an \Symfony\Component\Security\Core\Exception\AccessDeniedHttpException * if not accessible. * * @throws \Symfony\Component\Security\Core\Exception\AccessDeniedHttpException */ protected function checkACL(string $action, Request $request, $entity, $_format) { $this->denyAccessUnlessGranted($this->getRoleFor($action, $request, $entity, $_format), $entity); } protected function getActionConfig(string $action) { return $this->crudConfig['actions'][$action]; } /** * Set the crud configuration * * Used by the container to inject configuration for this crud. */ public function setCrudConfig(array $config): void { dump($config); $this->crudConfig = $config; } /** * @return PaginatorFactory */ protected function getPaginatorFactory(): PaginatorFactory { return $this->container->get(PaginatorFactory::class); } /** * Defined the services necessary for this controller * * @return array */ public static function getSubscribedServices(): array { return \array_merge( parent::getSubscribedServices(), [ PaginatorFactory::class => PaginatorFactory::class, ] ); } }