src/Controller/FrontendController.php line 51

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Serializer\EntitySerializer;
  4. use Doctrine\ORM\AbstractQuery;
  5. use Doctrine\ORM\EntityManager;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use phpDocumentor\Reflection\Types\Boolean;
  8. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  9. use Symfony\Component\HttpFoundation\RedirectResponse;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  12. use Symfony\Component\HttpFoundation\Response;
  13. use Symfony\Component\Routing\Annotation\Route;
  14. use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
  15. use Symfony\Component\Security\Csrf\CsrfToken;
  16. use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
  17. use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
  18. use Symfony\Component\HttpFoundation\Session\Session;
  19. use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
  20. class FrontendController extends AbstractController
  21. {
  22.     private $csrfTokenManager;
  23.     private $serializer;
  24.     private $entityManager;
  25.     private $urlGenerator;
  26.     private $session;
  27.     public function __construct(EntityManagerInterface $entityManager,
  28.                                 UrlGeneratorInterface $urlGenerator,
  29.                                 CsrfTokenManagerInterface $csrfTokenManager,
  30.                                 EntitySerializer $serializer
  31.     )
  32.     {
  33.         $this->serializer $serializer;
  34.         $this->csrfTokenManager $csrfTokenManager;
  35.         $this->entityManager $entityManager;
  36.         $this->urlGenerator $urlGenerator;
  37.         $this->session = new Session(new NativeSessionStorage(), new AttributeBag());
  38.     }
  39.     /**
  40.      * @Route("/", name="frontend_index")
  41.      */
  42.     public function index(): Response
  43.     {
  44.         return new RedirectResponse($this->urlGenerator->generate('administration_index'));
  45.         #return $this->render('home.html.twig', []);
  46.     }
  47. }