<?php
namespace App\Controller;
use App\Serializer\EntitySerializer;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use phpDocumentor\Reflection\Types\Boolean;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Csrf\CsrfToken;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
class FrontendController extends AbstractController
{
private $csrfTokenManager;
private $serializer;
private $entityManager;
private $urlGenerator;
private $session;
public function __construct(EntityManagerInterface $entityManager,
UrlGeneratorInterface $urlGenerator,
CsrfTokenManagerInterface $csrfTokenManager,
EntitySerializer $serializer
)
{
$this->serializer = $serializer;
$this->csrfTokenManager = $csrfTokenManager;
$this->entityManager = $entityManager;
$this->urlGenerator = $urlGenerator;
$this->session = new Session(new NativeSessionStorage(), new AttributeBag());
}
/**
* @Route("/", name="frontend_index")
*/
public function index(): Response
{
return new RedirectResponse($this->urlGenerator->generate('administration_index'));
#return $this->render('home.html.twig', []);
}
}