src/CoreBundle/Controller/DefaultController.php line 18

Open in your IDE?
  1. <?php
  2. namespace CoreBundle\Controller;
  3. use CoreBundle\Entity\Info;
  4. use Doctrine\ORM\EntityManagerInterface;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\RedirectResponse;
  7. use Symfony\Component\HttpFoundation\Response;
  8. class DefaultController extends AbstractController
  9. {
  10. public function __construct(private readonly EntityManagerInterface $entityManager)
  11. {
  12. }
  13. public function index(string $scope): RedirectResponse
  14. {
  15. if ($scope === 'gale' && $this->isGranted('IS_AUTHENTICATED_FULLY')) {
  16. return $this->redirectToRoute('login_redirect_route');
  17. }
  18. return $this->redirectToRoute('fos_user_security_login');
  19. }
  20. public function showColophon(): Response
  21. {
  22. $colophonBody = $this->entityManager->getRepository(Info::class)->findOneBy(['key' => 'colophon_body']);
  23. return $this->render('@ABaCusCore/Default/colophon/base.html.twig', [
  24. 'colophonBody' => $colophonBody ? $colophonBody->getValue() : ''
  25. ]);
  26. }
  27. }