getUser()) { $user = $this->getUser(); } else { $user = new User(); $user->setSource($this->getDoctrine() ->getRepository(AbstractSource::class) ->findOneBySlug(SystemSlugType::GUEST_USER)); } $requestedSource = new class() extends AbstractSource { }; $requestedSource->setSlug(SystemSlugType::IMPRINT); $requestedRight = new Right(); $requestedRight->setSource($requestedSource); $requestedRight->setReciever($user->getSource()); $requestedRight->setLayer(LayerType::SOURCE); $requestedRight->setType(RightType::READ); $secureSourceLoader = new SecureSourceLoader($this->getDoctrine()->getManager(), $requestedRight); $view = $this->view($secureSourceLoader->getSource(), 200) ->setTemplate('standard/imprint.html.twig') ->setTemplateVar('source'); return $this->handleView($view); } /** * @Route("/", name="homepage") */ public function homepage(): Response { return $this->render('standard/homepage.html.twig'); } protected function setEntityName(): void { $this->entityName = AbstractSource::class; } }