src/Controller/PersonnelAuthenticatorController.php line 46

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Service\CityServices;
  4. use App\Service\TraitementData;
  5. use App\Service\TraitementFolder;
  6. use Doctrine\ORM\EntityManagerInterface;
  7. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\Routing\Annotation\Route;
  10. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  11. use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
  12. use Exception;
  13. class PersonnelAuthenticatorController extends AbstractController
  14. {
  15.     /**
  16.      * @var EntityManagerInterface
  17.      */
  18.     protected $em;
  19.     /**
  20.      * @var CityServices
  21.      */
  22.     protected $cityServices;
  23.     /**
  24.      * @var TraitementData
  25.      */
  26.     protected $traitementData;
  27.     /**
  28.      * @var DenormalizerInterface
  29.      */
  30.     private $denormalizer;
  31.     public function __construct(TraitementData $traitementDataEntityManagerInterface $emCityServices $cityServicesDenormalizerInterface $denormalizer)
  32.     {
  33.         $this->em $em;
  34.         $this->cityServices $cityServices;
  35.         $this->traitementData $traitementData;
  36.         $this->denormalizer $denormalizer;
  37.     }
  38.     /**
  39.      * @Route("/admin/login", name="app_login")
  40.      */
  41.     public function login(AuthenticationUtils $authenticationUtilsTraitementFolder $traiteFolder): Response
  42.     {
  43.         $traiteFolder->add();
  44.         $error $authenticationUtils->getLastAuthenticationError();
  45.         $lastUsername $authenticationUtils->getLastUsername();
  46.         return $this->render('security/admin/login.html.twig', ['last_username' => $lastUsername'error' => $error]);
  47.     }
  48.     /**
  49.      * @Route("/admin/logout", name="app_logout")
  50.      *
  51.      * @throws Exception
  52.      */
  53.     public function logout(): void
  54.     {
  55.         throw new Exception('This method can be blank - it will be intercepted by the logout key on your firewall');
  56.     }
  57. }