Loading module/Formation/src/Formation/Controller/FormationController.php +21 −31 Changes for module/Formation/src/Formation/Controller/FormationController.php: 21 added lines, 31 removed lines. Original line number Diff line number Diff line Loading @@ -3,9 +3,10 @@ namespace Formation\Controller; use Application\Controller\AbstractController; use Formation\Service\Module\ModuleServiceAwareTrait; use Laminas\Http\Response; use Structure\Service\Etablissement\EtablissementServiceAwareTrait; use Formation\Entity\Db\Formation; use Formation\Entity\Db\Module; use Formation\Form\Formation\FormationFormAwareTrait; use Formation\Service\Formation\FormationServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; Loading @@ -15,13 +16,14 @@ class FormationController extends AbstractController { use EntityManagerAwareTrait; use FormationServiceAwareTrait; use ModuleServiceAwareTrait; use FormationFormAwareTrait; use EtablissementServiceAwareTrait; public function indexAction() : ViewModel { /** Recupération des paramètres du filtres */ /** Recupération des paramètres du filtre */ $filtres = [ 'site' => $this->params()->fromQuery('site'), 'libelle' => $this->params()->fromQuery('libelle'), Loading @@ -29,15 +31,14 @@ class FormationController extends AbstractController 'modalite' => $this->params()->fromQuery('modalite'), 'structure' => $this->params()->fromQuery('structure'), ]; /** Listing pour les filtres */ /** Listes pour les filtres */ $listings = [ 'sites' => $this->getEtablissementService()->getRepository()->findAllEtablissementsInscriptions(), 'responsables' => $this->getEntityManager()->getRepository(Formation::class)->fetchListeResponsable(), 'structures' => $this->getEntityManager()->getRepository(Formation::class)->fetchListeStructures(), 'responsables' => $this->getFormationService()->getRepository()->fetchListeResponsable(), 'structures' => $this->getFormationService()->getRepository()->fetchListeStructures(), ]; /** @var Formation[] $formations */ $formations = $this->getEntityManager()->getRepository(Formation::class)->fetchFormationsWithFiltres($filtres); $formations = $this->getFormationService()->getRepository()->fetchFormationsWithFiltres($filtres); return new ViewModel([ 'formations' => $formations, Loading @@ -46,19 +47,18 @@ class FormationController extends AbstractController ]); } public function afficherAction() public function afficherAction() : ViewModel { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); return new ViewModel([ 'formation' => $formation, ]); } public function ajouterAction() public function ajouterAction() : ViewModel { $module = $this->getEntityManager()->getRepository(Module::class)->getRequestedModule($this); $module = $this->getModuleService()->getRepository()->getRequestedModule($this); $formation = new Formation(); if ($module !== null) $formation->setModule($module); Loading @@ -84,10 +84,9 @@ class FormationController extends AbstractController return $vm; } public function modifierAction() public function modifierAction() : ViewModel { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $form = $this->getFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('formation/formation/modifier', [], [], true)); Loading @@ -110,39 +109,30 @@ class FormationController extends AbstractController return $vm; } public function historiserAction() public function historiserAction() : Response { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $this->getFormationService()->historise($formation); $retour = $this->params()->fromQuery('retour'); if ($retour !== null) { return $this->redirect()->toUrl($retour); } if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('formation/formation'); } public function restaurerAction() public function restaurerAction() : Response { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $this->getFormationService()->restore($formation); $retour = $this->params()->fromQuery('retour'); if ($retour !== null) { return $this->redirect()->toUrl($retour); } if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('formation/formation'); } public function supprimerAction() { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $request = $this->getRequest(); if ($request->isPost()) { Loading module/Formation/src/Formation/Controller/FormationControllerFactory.php +9 −1 Changes for module/Formation/src/Formation/Controller/FormationControllerFactory.php: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Formation\Controller; use Formation\Service\Module\ModuleService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Structure\Service\Etablissement\EtablissementService; use Doctrine\ORM\EntityManager; use Formation\Form\Formation\FormationForm; Loading @@ -13,17 +16,21 @@ class FormationControllerFactory { /** * @param ContainerInterface $container * @return FormationController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) public function __invoke(ContainerInterface $container) : FormationController { /** * @var EntityManager $entityManager * @var EtablissementService $etablissementService * @var FormationService $formationService * @var ModuleService $moduleService */ $entityManager = $container->get('doctrine.entitymanager.orm_default'); $etablissementService = $container->get(EtablissementService::class); $formationService = $container->get(FormationService::class); $moduleService = $container->get(ModuleService::class); /** * @var FormationForm $formationForm Loading @@ -34,6 +41,7 @@ class FormationControllerFactory { $controller->setEntityManager($entityManager); $controller->setEtablissementService($etablissementService); $controller->setFormationService($formationService); $controller->setModuleService($moduleService); $controller->setFormationForm($formationForm); return $controller; } Loading module/Formation/src/Formation/Entity/Db/Formation.php +9 −24 Changes for module/Formation/src/Formation/Entity/Db/Formation.php: 9 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -20,30 +20,15 @@ class Formation implements HistoriqueAwareInterface, use HasModaliteTrait; use HasTypeTrait; /** @var int */ private $id; /** @var string|null */ private $libelle; /** @var string|null */ private $description; /** @var string|null */ private $lien; /** @var Module|null */ private $module; /** @var Collection (Session) */ private $sessions; /** @var Individu|null */ private $responsable; /** @var int */ private $tailleListePrincipale; /** @var int */ private $tailleListeComplementaire; private int $id; private ?string $libelle = null; private ?string $description = null; private ?string $lien = null; private ?Module $module = null; private Collection $sessions; private ?Individu $responsable = null; private ?int $tailleListePrincipale = null; private ?int $tailleListeComplementaire = null; /** * @return int Loading module/Formation/src/Formation/Form/Formation/FormationForm.php +5 −4 Changes for module/Formation/src/Formation/Form/Formation/FormationForm.php: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -19,8 +19,7 @@ class FormationForm extends Form { use StructureServiceAwareTrait; use ModuleServiceAwareTrait; /** @var string */ private $urlResponsable; private string $urlResponsable; /** * @param string $urlResponsable Loading @@ -39,7 +38,8 @@ class FormationForm extends Form { 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libellé de la formation :", 'label' => "Libellé de la formation <span class='icon icon-star' style='color: darkred;' title='Obligatoire'></span> :", 'label_options' => [ 'disable_html_escape' => true, ], ], 'attributes' => [ 'id' => 'libelle', Loading Loading @@ -74,7 +74,8 @@ class FormationForm extends Form { 'type' => Select::class, 'name' => 'module', 'options' => [ 'label' => "Module associé à la formation :", 'label' => "Module associé à la formation <span class='icon icon-star' style='color: darkred;' title='Obligatoire'></span> :", 'label_options' => [ 'disable_html_escape' => true, ], 'empty_option' => "Aucun module", 'value_options' => $this->getModuleService()->getModulesAsOptions(), ], Loading module/Formation/src/Formation/Form/Formation/FormationFormAwareTrait.php +2 −5 Changes for module/Formation/src/Formation/Form/Formation/FormationFormAwareTrait.php: 2 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ namespace Formation\Form\Formation; trait FormationFormAwareTrait { /** @var FormationForm */ private $formationForm; private FormationForm $formationForm; /** * @return FormationForm Loading @@ -17,11 +16,9 @@ trait FormationFormAwareTrait { /** * @param FormationForm $formationForm * @return FormationForm */ public function setFormationForm(FormationForm $formationForm): FormationForm public function setFormationForm(FormationForm $formationForm): void { $this->formationForm = $formationForm; return $this->formationForm; } } No newline at end of file Loading
module/Formation/src/Formation/Controller/FormationController.php +21 −31 Changes for module/Formation/src/Formation/Controller/FormationController.php: 21 added lines, 31 removed lines. Original line number Diff line number Diff line Loading @@ -3,9 +3,10 @@ namespace Formation\Controller; use Application\Controller\AbstractController; use Formation\Service\Module\ModuleServiceAwareTrait; use Laminas\Http\Response; use Structure\Service\Etablissement\EtablissementServiceAwareTrait; use Formation\Entity\Db\Formation; use Formation\Entity\Db\Module; use Formation\Form\Formation\FormationFormAwareTrait; use Formation\Service\Formation\FormationServiceAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait; Loading @@ -15,13 +16,14 @@ class FormationController extends AbstractController { use EntityManagerAwareTrait; use FormationServiceAwareTrait; use ModuleServiceAwareTrait; use FormationFormAwareTrait; use EtablissementServiceAwareTrait; public function indexAction() : ViewModel { /** Recupération des paramètres du filtres */ /** Recupération des paramètres du filtre */ $filtres = [ 'site' => $this->params()->fromQuery('site'), 'libelle' => $this->params()->fromQuery('libelle'), Loading @@ -29,15 +31,14 @@ class FormationController extends AbstractController 'modalite' => $this->params()->fromQuery('modalite'), 'structure' => $this->params()->fromQuery('structure'), ]; /** Listing pour les filtres */ /** Listes pour les filtres */ $listings = [ 'sites' => $this->getEtablissementService()->getRepository()->findAllEtablissementsInscriptions(), 'responsables' => $this->getEntityManager()->getRepository(Formation::class)->fetchListeResponsable(), 'structures' => $this->getEntityManager()->getRepository(Formation::class)->fetchListeStructures(), 'responsables' => $this->getFormationService()->getRepository()->fetchListeResponsable(), 'structures' => $this->getFormationService()->getRepository()->fetchListeStructures(), ]; /** @var Formation[] $formations */ $formations = $this->getEntityManager()->getRepository(Formation::class)->fetchFormationsWithFiltres($filtres); $formations = $this->getFormationService()->getRepository()->fetchFormationsWithFiltres($filtres); return new ViewModel([ 'formations' => $formations, Loading @@ -46,19 +47,18 @@ class FormationController extends AbstractController ]); } public function afficherAction() public function afficherAction() : ViewModel { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); return new ViewModel([ 'formation' => $formation, ]); } public function ajouterAction() public function ajouterAction() : ViewModel { $module = $this->getEntityManager()->getRepository(Module::class)->getRequestedModule($this); $module = $this->getModuleService()->getRepository()->getRequestedModule($this); $formation = new Formation(); if ($module !== null) $formation->setModule($module); Loading @@ -84,10 +84,9 @@ class FormationController extends AbstractController return $vm; } public function modifierAction() public function modifierAction() : ViewModel { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $form = $this->getFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('formation/formation/modifier', [], [], true)); Loading @@ -110,39 +109,30 @@ class FormationController extends AbstractController return $vm; } public function historiserAction() public function historiserAction() : Response { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $this->getFormationService()->historise($formation); $retour = $this->params()->fromQuery('retour'); if ($retour !== null) { return $this->redirect()->toUrl($retour); } if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('formation/formation'); } public function restaurerAction() public function restaurerAction() : Response { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $this->getFormationService()->restore($formation); $retour = $this->params()->fromQuery('retour'); if ($retour !== null) { return $this->redirect()->toUrl($retour); } if ($retour !== null) return $this->redirect()->toUrl($retour); return $this->redirect()->toRoute('formation/formation'); } public function supprimerAction() { /** @var Formation|null $formation */ $formation = $this->getEntityManager()->getRepository(Formation::class)->getRequestedFormation($this); $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $request = $this->getRequest(); if ($request->isPost()) { Loading
module/Formation/src/Formation/Controller/FormationControllerFactory.php +9 −1 Changes for module/Formation/src/Formation/Controller/FormationControllerFactory.php: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ namespace Formation\Controller; use Formation\Service\Module\ModuleService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Structure\Service\Etablissement\EtablissementService; use Doctrine\ORM\EntityManager; use Formation\Form\Formation\FormationForm; Loading @@ -13,17 +16,21 @@ class FormationControllerFactory { /** * @param ContainerInterface $container * @return FormationController * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) public function __invoke(ContainerInterface $container) : FormationController { /** * @var EntityManager $entityManager * @var EtablissementService $etablissementService * @var FormationService $formationService * @var ModuleService $moduleService */ $entityManager = $container->get('doctrine.entitymanager.orm_default'); $etablissementService = $container->get(EtablissementService::class); $formationService = $container->get(FormationService::class); $moduleService = $container->get(ModuleService::class); /** * @var FormationForm $formationForm Loading @@ -34,6 +41,7 @@ class FormationControllerFactory { $controller->setEntityManager($entityManager); $controller->setEtablissementService($etablissementService); $controller->setFormationService($formationService); $controller->setModuleService($moduleService); $controller->setFormationForm($formationForm); return $controller; } Loading
module/Formation/src/Formation/Entity/Db/Formation.php +9 −24 Changes for module/Formation/src/Formation/Entity/Db/Formation.php: 9 added lines, 24 removed lines. Original line number Diff line number Diff line Loading @@ -20,30 +20,15 @@ class Formation implements HistoriqueAwareInterface, use HasModaliteTrait; use HasTypeTrait; /** @var int */ private $id; /** @var string|null */ private $libelle; /** @var string|null */ private $description; /** @var string|null */ private $lien; /** @var Module|null */ private $module; /** @var Collection (Session) */ private $sessions; /** @var Individu|null */ private $responsable; /** @var int */ private $tailleListePrincipale; /** @var int */ private $tailleListeComplementaire; private int $id; private ?string $libelle = null; private ?string $description = null; private ?string $lien = null; private ?Module $module = null; private Collection $sessions; private ?Individu $responsable = null; private ?int $tailleListePrincipale = null; private ?int $tailleListeComplementaire = null; /** * @return int Loading
module/Formation/src/Formation/Form/Formation/FormationForm.php +5 −4 Changes for module/Formation/src/Formation/Form/Formation/FormationForm.php: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -19,8 +19,7 @@ class FormationForm extends Form { use StructureServiceAwareTrait; use ModuleServiceAwareTrait; /** @var string */ private $urlResponsable; private string $urlResponsable; /** * @param string $urlResponsable Loading @@ -39,7 +38,8 @@ class FormationForm extends Form { 'type' => Text::class, 'name' => 'libelle', 'options' => [ 'label' => "Libellé de la formation :", 'label' => "Libellé de la formation <span class='icon icon-star' style='color: darkred;' title='Obligatoire'></span> :", 'label_options' => [ 'disable_html_escape' => true, ], ], 'attributes' => [ 'id' => 'libelle', Loading Loading @@ -74,7 +74,8 @@ class FormationForm extends Form { 'type' => Select::class, 'name' => 'module', 'options' => [ 'label' => "Module associé à la formation :", 'label' => "Module associé à la formation <span class='icon icon-star' style='color: darkred;' title='Obligatoire'></span> :", 'label_options' => [ 'disable_html_escape' => true, ], 'empty_option' => "Aucun module", 'value_options' => $this->getModuleService()->getModulesAsOptions(), ], Loading
module/Formation/src/Formation/Form/Formation/FormationFormAwareTrait.php +2 −5 Changes for module/Formation/src/Formation/Form/Formation/FormationFormAwareTrait.php: 2 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ namespace Formation\Form\Formation; trait FormationFormAwareTrait { /** @var FormationForm */ private $formationForm; private FormationForm $formationForm; /** * @return FormationForm Loading @@ -17,11 +16,9 @@ trait FormationFormAwareTrait { /** * @param FormationForm $formationForm * @return FormationForm */ public function setFormationForm(FormationForm $formationForm): FormationForm public function setFormationForm(FormationForm $formationForm): void { $this->formationForm = $formationForm; return $this->formationForm; } } No newline at end of file