<?php
namespace App\Controller;
use App\Service\CityServices;
use App\Service\TraitementData;
use App\Service\TraitementFolder;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Exception;
class PersonnelAuthenticatorController extends AbstractController
{
/**
* @var EntityManagerInterface
*/
protected $em;
/**
* @var CityServices
*/
protected $cityServices;
/**
* @var TraitementData
*/
protected $traitementData;
/**
* @var DenormalizerInterface
*/
private $denormalizer;
public function __construct(TraitementData $traitementData, EntityManagerInterface $em, CityServices $cityServices, DenormalizerInterface $denormalizer)
{
$this->em = $em;
$this->cityServices = $cityServices;
$this->traitementData = $traitementData;
$this->denormalizer = $denormalizer;
}
/**
* @Route("/admin/login", name="app_login")
*/
public function login(AuthenticationUtils $authenticationUtils, TraitementFolder $traiteFolder): Response
{
$traiteFolder->add();
$error = $authenticationUtils->getLastAuthenticationError();
$lastUsername = $authenticationUtils->getLastUsername();
return $this->render('security/admin/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);
}
/**
* @Route("/admin/logout", name="app_logout")
*
* @throws Exception
*/
public function logout(): void
{
throw new Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
}
}