Loading src/UnicaenEvenement/Controller/EtatController.php +3 −5 Original line number Diff line number Diff line Loading @@ -14,11 +14,10 @@ class EtatController extends AbstractActionController { use EtatServiceAwareTrait; use EtatFormAwareTrait; public function ajouterAction() public function ajouterAction(): ViewModel { $etat = new Etat(); /** @var EtatForm $form */ $form = $this->getEtatForm(); $form->setAttribute('action', $this->url()->fromRoute('unicaen-evenement/etat/ajouter', [], [], true)); $form->bind($etat); Loading @@ -42,11 +41,10 @@ class EtatController extends AbstractActionController { return $vm; } public function modifierAction() public function modifierAction(): ViewModel { $etat = $this->getEtatEvenementService()->getRequestedEtat($this); /** @var EtatForm $form */ $form = $this->getEtatForm(); $form->setAttribute('action', $this->url()->fromRoute('unicaen-evenement/etat/modifier', ['etat' => $etat->getId()], [], true)); $form->bind($etat); Loading @@ -70,7 +68,7 @@ class EtatController extends AbstractActionController { return $vm; } public function supprimerAction() public function supprimerAction(): ViewModel { $etat = $this->getEtatEvenementService()->getRequestedEtat($this); Loading src/UnicaenEvenement/Controller/EtatControllerFactory.php +7 −2 Original line number Diff line number Diff line Loading @@ -2,13 +2,19 @@ namespace UnicaenEvenement\Controller; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenEvenement\Form\Etat\EtatForm; use UnicaenEvenement\Service\Etat\EtatService; use Interop\Container\ContainerInterface; class EtatControllerFactory { public function __invoke(ContainerInterface $container) /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container): EtatController { /** * @var EtatService $etatService Loading @@ -17,7 +23,6 @@ class EtatControllerFactory { $etatService = $container->get(EtatService::class); $etatForm = $container->get('FormElementManager')->get(EtatForm::class); /** @var EtatController $controller */ $controller = new EtatController(); $controller->setEtatEvenementService($etatService); $controller->setEtatForm($etatForm); Loading src/UnicaenEvenement/Controller/EvenementConsoleController.php +8 −7 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenEvenement\Controller; use DateTime; use Exception; use RuntimeException; use Unicaen\Console\ColorInterface; use Unicaen\Console\Controller\AbstractConsoleController; use Unicaen\Console\Request as ConsoleRequest; Loading @@ -28,16 +29,16 @@ class EvenementConsoleController extends AbstractConsoleController */ const MAX_EXECUTION_TIME = 60; public function traiterEvenementsAction() public function traiterEvenementsAction(): void { $request = $this->getRequest(); $texte = ""; if (!$request instanceof ConsoleRequest) { throw new \RuntimeException('Cette action doit être appelée depuis une console !'); throw new RuntimeException('Cette action doit être appelée depuis une console !'); } if ($this->getJournalService()->isRunning()) { throw new \RuntimeException('Un traitement est déjà en cours !'); throw new RuntimeException('Un traitement est déjà en cours !'); } $journal = new Journal(); Loading @@ -46,7 +47,7 @@ class EvenementConsoleController extends AbstractConsoleController $this->getJournalService()->create($journal); $start = new DateTime(); $this->getConsole()->writeLine("\n* " . ($titre = "Traitement des événements en attente") . " *\n", ColorInterface::LIGHT_GREEN); $this->getConsole()->writeLine("\n* " . ("Traitement des événements en attente") . " *\n", ColorInterface::LIGHT_GREEN); $this->getConsole()->writeLine("Debut du traitement", ColorInterface::GREEN); $this->getConsole()->writeLine("-------------------\n", ColorInterface::GREEN); Loading @@ -59,7 +60,7 @@ class EvenementConsoleController extends AbstractConsoleController // calcul du temps d'exécution $executionTime = (new DateTime())->getTimestamp() - $start->getTimestamp(); if ($executionTime >= self::MAX_EXECUTION_TIME) { // si le temps d'exécution maximal est dépassé on quitte la procédure // si le temps d'exécution maximal est dépassé ; on quitte la procédure break; } Loading @@ -83,12 +84,12 @@ class EvenementConsoleController extends AbstractConsoleController $this->getConsole()->writeLine("\n-------------------", ColorInterface::GREEN); $this->getConsole()->writeLine("Fin du traitement", ColorInterface::GREEN); $texte .= "Fin du traitement : " . (new DateTime())->format('d/m/Y H:i:s') . ""; $texte .= "Fin du traitement : " . (new DateTime())->format('d/m/Y H:i:s') ; $this->getConsole()->writeLine("\nRapport", ColorInterface::CYAN); $this->getConsole()->writeLine("-------", ColorInterface::CYAN); $this->getConsole()->writeLine(sprintf("* Nombre d'opérations : %s", $nbOp), ColorInterface::CYAN); $this->getConsole()->writeLine(sprintf("* Temps estimé : %s", $diff = $start->diff(new DateTime())->format('%Hh %Im %Ss')), ColorInterface::CYAN); $this->getConsole()->writeLine(sprintf("* Temps estimé : %s", $start->diff(new DateTime())->format('%Hh %Im %Ss')), ColorInterface::CYAN); $journal->setLog($texte); $journal->setEtat($this->getEtatEvenementService()->findByCode(Etat::SUCCES)); Loading src/UnicaenEvenement/Controller/EvenementConsoleControllerFactory.php +4 −3 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace UnicaenEvenement\Controller; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenEvenement\Service\Etat\EtatService; use UnicaenEvenement\Service\Evenement\EvenementService; use UnicaenEvenement\Service\EvenementGestion\EvenementGestionService; Loading @@ -11,8 +13,8 @@ use UnicaenEvenement\Service\Journal\JournalService; class EvenementConsoleControllerFactory { /** * @param ContainerInterface $container * @return EvenementConsoleController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) : EvenementConsoleController { Loading @@ -27,7 +29,6 @@ class EvenementConsoleControllerFactory { $etatService = $container->get(EtatService::class); $journalService = $container->get(JournalService::class); /** @var EvenementConsoleController $controller */ $controller = new EvenementConsoleController(); $controller->setEvenementService($evenementService); $controller->setEvenementGestionService($evenementGestionService); Loading src/UnicaenEvenement/Controller/EvenementControllerFactory.php +0 −2 Original line number Diff line number Diff line Loading @@ -15,8 +15,6 @@ use UnicaenEvenement\Service\Type\TypeService; class EvenementControllerFactory { /** * @param ContainerInterface $container * @return EvenementController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ Loading Loading
src/UnicaenEvenement/Controller/EtatController.php +3 −5 Original line number Diff line number Diff line Loading @@ -14,11 +14,10 @@ class EtatController extends AbstractActionController { use EtatServiceAwareTrait; use EtatFormAwareTrait; public function ajouterAction() public function ajouterAction(): ViewModel { $etat = new Etat(); /** @var EtatForm $form */ $form = $this->getEtatForm(); $form->setAttribute('action', $this->url()->fromRoute('unicaen-evenement/etat/ajouter', [], [], true)); $form->bind($etat); Loading @@ -42,11 +41,10 @@ class EtatController extends AbstractActionController { return $vm; } public function modifierAction() public function modifierAction(): ViewModel { $etat = $this->getEtatEvenementService()->getRequestedEtat($this); /** @var EtatForm $form */ $form = $this->getEtatForm(); $form->setAttribute('action', $this->url()->fromRoute('unicaen-evenement/etat/modifier', ['etat' => $etat->getId()], [], true)); $form->bind($etat); Loading @@ -70,7 +68,7 @@ class EtatController extends AbstractActionController { return $vm; } public function supprimerAction() public function supprimerAction(): ViewModel { $etat = $this->getEtatEvenementService()->getRequestedEtat($this); Loading
src/UnicaenEvenement/Controller/EtatControllerFactory.php +7 −2 Original line number Diff line number Diff line Loading @@ -2,13 +2,19 @@ namespace UnicaenEvenement\Controller; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenEvenement\Form\Etat\EtatForm; use UnicaenEvenement\Service\Etat\EtatService; use Interop\Container\ContainerInterface; class EtatControllerFactory { public function __invoke(ContainerInterface $container) /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container): EtatController { /** * @var EtatService $etatService Loading @@ -17,7 +23,6 @@ class EtatControllerFactory { $etatService = $container->get(EtatService::class); $etatForm = $container->get('FormElementManager')->get(EtatForm::class); /** @var EtatController $controller */ $controller = new EtatController(); $controller->setEtatEvenementService($etatService); $controller->setEtatForm($etatForm); Loading
src/UnicaenEvenement/Controller/EvenementConsoleController.php +8 −7 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace UnicaenEvenement\Controller; use DateTime; use Exception; use RuntimeException; use Unicaen\Console\ColorInterface; use Unicaen\Console\Controller\AbstractConsoleController; use Unicaen\Console\Request as ConsoleRequest; Loading @@ -28,16 +29,16 @@ class EvenementConsoleController extends AbstractConsoleController */ const MAX_EXECUTION_TIME = 60; public function traiterEvenementsAction() public function traiterEvenementsAction(): void { $request = $this->getRequest(); $texte = ""; if (!$request instanceof ConsoleRequest) { throw new \RuntimeException('Cette action doit être appelée depuis une console !'); throw new RuntimeException('Cette action doit être appelée depuis une console !'); } if ($this->getJournalService()->isRunning()) { throw new \RuntimeException('Un traitement est déjà en cours !'); throw new RuntimeException('Un traitement est déjà en cours !'); } $journal = new Journal(); Loading @@ -46,7 +47,7 @@ class EvenementConsoleController extends AbstractConsoleController $this->getJournalService()->create($journal); $start = new DateTime(); $this->getConsole()->writeLine("\n* " . ($titre = "Traitement des événements en attente") . " *\n", ColorInterface::LIGHT_GREEN); $this->getConsole()->writeLine("\n* " . ("Traitement des événements en attente") . " *\n", ColorInterface::LIGHT_GREEN); $this->getConsole()->writeLine("Debut du traitement", ColorInterface::GREEN); $this->getConsole()->writeLine("-------------------\n", ColorInterface::GREEN); Loading @@ -59,7 +60,7 @@ class EvenementConsoleController extends AbstractConsoleController // calcul du temps d'exécution $executionTime = (new DateTime())->getTimestamp() - $start->getTimestamp(); if ($executionTime >= self::MAX_EXECUTION_TIME) { // si le temps d'exécution maximal est dépassé on quitte la procédure // si le temps d'exécution maximal est dépassé ; on quitte la procédure break; } Loading @@ -83,12 +84,12 @@ class EvenementConsoleController extends AbstractConsoleController $this->getConsole()->writeLine("\n-------------------", ColorInterface::GREEN); $this->getConsole()->writeLine("Fin du traitement", ColorInterface::GREEN); $texte .= "Fin du traitement : " . (new DateTime())->format('d/m/Y H:i:s') . ""; $texte .= "Fin du traitement : " . (new DateTime())->format('d/m/Y H:i:s') ; $this->getConsole()->writeLine("\nRapport", ColorInterface::CYAN); $this->getConsole()->writeLine("-------", ColorInterface::CYAN); $this->getConsole()->writeLine(sprintf("* Nombre d'opérations : %s", $nbOp), ColorInterface::CYAN); $this->getConsole()->writeLine(sprintf("* Temps estimé : %s", $diff = $start->diff(new DateTime())->format('%Hh %Im %Ss')), ColorInterface::CYAN); $this->getConsole()->writeLine(sprintf("* Temps estimé : %s", $start->diff(new DateTime())->format('%Hh %Im %Ss')), ColorInterface::CYAN); $journal->setLog($texte); $journal->setEtat($this->getEtatEvenementService()->findByCode(Etat::SUCCES)); Loading
src/UnicaenEvenement/Controller/EvenementConsoleControllerFactory.php +4 −3 Original line number Diff line number Diff line Loading @@ -3,6 +3,8 @@ namespace UnicaenEvenement\Controller; use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenEvenement\Service\Etat\EtatService; use UnicaenEvenement\Service\Evenement\EvenementService; use UnicaenEvenement\Service\EvenementGestion\EvenementGestionService; Loading @@ -11,8 +13,8 @@ use UnicaenEvenement\Service\Journal\JournalService; class EvenementConsoleControllerFactory { /** * @param ContainerInterface $container * @return EvenementConsoleController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) : EvenementConsoleController { Loading @@ -27,7 +29,6 @@ class EvenementConsoleControllerFactory { $etatService = $container->get(EtatService::class); $journalService = $container->get(JournalService::class); /** @var EvenementConsoleController $controller */ $controller = new EvenementConsoleController(); $controller->setEvenementService($evenementService); $controller->setEvenementGestionService($evenementGestionService); Loading
src/UnicaenEvenement/Controller/EvenementControllerFactory.php +0 −2 Original line number Diff line number Diff line Loading @@ -15,8 +15,6 @@ use UnicaenEvenement\Service\Type\TypeService; class EvenementControllerFactory { /** * @param ContainerInterface $container * @return EvenementController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ Loading