src/Controller/SecurityController.php line 18
<?phpnamespace App\Controller;use Symfony\Bundle\FrameworkBundle\Console\Application;use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;use Symfony\Component\Console\Input\ArrayInput;use Symfony\Component\Console\Output\BufferedOutput;use Symfony\Component\HttpFoundation\Response;use Symfony\Component\HttpKernel\KernelInterface;use Symfony\Component\Routing\Annotation\Route;use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;class SecurityController extends AbstractController{/* Route par défaut de l'app, sur le Login */#[Route(path: '/', name: 'app_login')]public function login(AuthenticationUtils $authenticationUtils): Response{// if ($this->getUser()) {// return $this->redirectToRoute('target_path');// }// get the login error if there is one$error = $authenticationUtils->getLastAuthenticationError();// last username entered by the user$lastUsername = $authenticationUtils->getLastUsername();return $this->render('security/login.html.twig', ['last_username' => $lastUsername, 'error' => $error]);}/* Déconnexion du User */#[Route(path: '/logout', name: 'app_logout')]public function logout(): void{throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');}/* Route pour exécuter 'VerifDebutContratCommand', pour la tache CRON depuis Infomaniak */#[Route(path: '/commande/debut-contrat', name: 'commande-debut-contrat')]public function commandeDebutContrat(KernelInterface $kernel): Response{/* Création d'une console avec kernel */$application = new Application($kernel);$application->setAutoExit(false);/* Input de la console */$input = new ArrayInput(['command' => 'verif-debut-contrat']);/* Stockage de la sortie de la commande */$output = new BufferedOutput();/* Exécution de la commande */$application->run($input, $output);/* Récupération de la sortie de la commande */$content = $output->fetch();/* Sortie de la commande au format HTTP */return new Response($content);}/* Route pour exécuter 'VerifFinContratCommand', pour la tache CRON depuis Infomaniak */#[Route(path: '/commande/fin-contrat', name: 'commande-fin-contrat')]public function commandeFinContrat(KernelInterface $kernel): Response{/* Création d'une console avec kernel */$application = new Application($kernel);$application->setAutoExit(false);/* Input de la console */$input = new ArrayInput(['command' => 'verif-fin-contrat']);/* Stockage de la sortie de la commande */$output = new BufferedOutput();/* Exécution de la commande */$application->run($input, $output);/* Récupération de la sortie de la commande */$content = $output->fetch();/* Sortie de la commande au format HTTP */return new Response($content);}/* Route pour exécuter 'VerifRenouvellementContratCommand', pour la tache CRON depuis Infomaniak */#[Route(path: '/commande/renouvellement-contrat', name: 'commande-renouvellement-contrat')]public function commandeRenouvellementContrat(KernelInterface $kernel): Response{/* Création d'une console avec kernel */$application = new Application($kernel);$application->setAutoExit(false);/* Input de la console */$input = new ArrayInput(['command' => 'verif-renouvellement-contrat']);/* Stockage de la sortie de la commande */$output = new BufferedOutput();/* Exécution de la commande */$application->run($input, $output);/* Récupération de la sortie de la commande */$content = $output->fetch();/* Sortie de la commande au format HTTP */return new Response($content);}/* Route pour exécuter 'MaintenanceContratCommand', pour la tache CRON depuis Infomaniak */#[Route(path: '/commande/maintenance-contrat', name: 'commande-maintenance-contrat')]public function commandeMaintenanceContrat(KernelInterface $kernel): Response{/* Création d'une console avec kernel */$application = new Application($kernel);$application->setAutoExit(false);/* Input de la console */$input = new ArrayInput(['command' => 'maintenance-contrat']);/* Stockage de la sortie de la commande */$output = new BufferedOutput();/* Exécution de la commande */$application->run($input, $output);/* Récupération de la sortie de la commande */$content = $output->fetch();/* Sortie de la commande au format HTTP */return new Response($content);}}