Loading module/Formation/src/Formation/Controller/FormationController.php +5 −1 Changes for module/Formation/src/Formation/Controller/FormationController.php: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Formation\Controller; use Application\Controller\AbstractController; use Formation\Service\Module\ModuleServiceAwareTrait; use Formation\Service\Session\SessionServiceAwareTrait; use Laminas\Http\Response; use Structure\Service\Etablissement\EtablissementServiceAwareTrait; use Formation\Entity\Db\Formation; Loading @@ -17,16 +18,19 @@ class FormationController extends AbstractController use EntityManagerAwareTrait; use FormationServiceAwareTrait; use ModuleServiceAwareTrait; use SessionServiceAwareTrait; use FormationFormAwareTrait; use EtablissementServiceAwareTrait; public function afficherAction() public function afficherAction() : ViewModel { $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $sessions = $this->getSessionService()->getRepository()->fetchSessionsByFormation($formation, 'id', 'asc', true); return new ViewModel([ 'formation' => $formation, 'sessions' => $sessions, ]); } Loading module/Formation/src/Formation/Controller/FormationControllerFactory.php +4 −0 Changes for module/Formation/src/Formation/Controller/FormationControllerFactory.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Formation\Controller; use Formation\Service\Module\ModuleService; use Formation\Service\Session\SessionService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Structure\Service\Etablissement\EtablissementService; Loading @@ -26,11 +27,13 @@ class FormationControllerFactory { * @var EtablissementService $etablissementService * @var FormationService $formationService * @var ModuleService $moduleService * @var SessionService $sessionService */ $entityManager = $container->get('doctrine.entitymanager.orm_default'); $etablissementService = $container->get(EtablissementService::class); $formationService = $container->get(FormationService::class); $moduleService = $container->get(ModuleService::class); $sessionService = $container->get(SessionService::class); /** * @var FormationForm $formationForm Loading @@ -42,6 +45,7 @@ class FormationControllerFactory { $controller->setEtablissementService($etablissementService); $controller->setFormationService($formationService); $controller->setModuleService($moduleService); $controller->setSessionService($sessionService); $controller->setFormationForm($formationForm); return $controller; } Loading module/Formation/src/Formation/Controller/SessionController.php +3 −0 Changes for module/Formation/src/Formation/Controller/SessionController.php: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -81,6 +81,9 @@ class SessionController extends AbstractController $form->setData($data); if ($form->isValid()) { $this->getSessionService()->create($session); $enPrepration = $this->getEntityManager()->getRepository(Etat::class)->findOneBy(["code" => Etat::CODE_PREPARATION]); $session->setEtat($enPrepration); $this->getSessionService()->update($session); } } Loading module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php +22 −0 Changes for module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Doctorant\Entity\Db\Doctorant; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Formation\Entity\Db\Etat; use Formation\Entity\Db\Formation; use Formation\Entity\Db\Interfaces\HasTypeInterface; use Formation\Entity\Db\Session; use Individu\Entity\Db\Individu; Loading Loading @@ -163,4 +164,25 @@ class SessionRepository extends EntityRepository $result = $qb->getQuery()->getResult(); return $result; } /** * @param Formation|null $formation * @param string $champ * @param string $ordre * @param bool $keep_histo * @return array */ public function fetchSessionsByFormation(?Formation $formation, string $champ='id', string $ordre='ASC', bool $keep_histo = false) : array { $qb = $this->createQB('session') ->orderBy('session.' . $champ, $ordre); if ($formation !== null) $qb = $qb->andWhere('session.formation = :formation')->setParameter('formation', $formation); else $qb = $qb->andWhere('session.formation IS NULL'); if (!$keep_histo) $qb = $qb->andWhere('session.histoDestruction IS NULL'); $result = $qb->getQuery()->getResult(); return $result; } } No newline at end of file module/Formation/src/Formation/Entity/Db/Session.php +1 −1 Changes for module/Formation/src/Formation/Entity/Db/Session.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class Session implements HistoriqueAwareInterface, private ?Individu $responsable = null; private ?Etat $etat = null; private ?string $description; private ?string $description = null; private Collection $structuresComplemenaires; private Collection $seances; Loading Loading
module/Formation/src/Formation/Controller/FormationController.php +5 −1 Changes for module/Formation/src/Formation/Controller/FormationController.php: 5 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Formation\Controller; use Application\Controller\AbstractController; use Formation\Service\Module\ModuleServiceAwareTrait; use Formation\Service\Session\SessionServiceAwareTrait; use Laminas\Http\Response; use Structure\Service\Etablissement\EtablissementServiceAwareTrait; use Formation\Entity\Db\Formation; Loading @@ -17,16 +18,19 @@ class FormationController extends AbstractController use EntityManagerAwareTrait; use FormationServiceAwareTrait; use ModuleServiceAwareTrait; use SessionServiceAwareTrait; use FormationFormAwareTrait; use EtablissementServiceAwareTrait; public function afficherAction() public function afficherAction() : ViewModel { $formation = $this->getFormationService()->getRepository()->getRequestedFormation($this); $sessions = $this->getSessionService()->getRepository()->fetchSessionsByFormation($formation, 'id', 'asc', true); return new ViewModel([ 'formation' => $formation, 'sessions' => $sessions, ]); } Loading
module/Formation/src/Formation/Controller/FormationControllerFactory.php +4 −0 Changes for module/Formation/src/Formation/Controller/FormationControllerFactory.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ namespace Formation\Controller; use Formation\Service\Module\ModuleService; use Formation\Service\Session\SessionService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Structure\Service\Etablissement\EtablissementService; Loading @@ -26,11 +27,13 @@ class FormationControllerFactory { * @var EtablissementService $etablissementService * @var FormationService $formationService * @var ModuleService $moduleService * @var SessionService $sessionService */ $entityManager = $container->get('doctrine.entitymanager.orm_default'); $etablissementService = $container->get(EtablissementService::class); $formationService = $container->get(FormationService::class); $moduleService = $container->get(ModuleService::class); $sessionService = $container->get(SessionService::class); /** * @var FormationForm $formationForm Loading @@ -42,6 +45,7 @@ class FormationControllerFactory { $controller->setEtablissementService($etablissementService); $controller->setFormationService($formationService); $controller->setModuleService($moduleService); $controller->setSessionService($sessionService); $controller->setFormationForm($formationForm); return $controller; } Loading
module/Formation/src/Formation/Controller/SessionController.php +3 −0 Changes for module/Formation/src/Formation/Controller/SessionController.php: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -81,6 +81,9 @@ class SessionController extends AbstractController $form->setData($data); if ($form->isValid()) { $this->getSessionService()->create($session); $enPrepration = $this->getEntityManager()->getRepository(Etat::class)->findOneBy(["code" => Etat::CODE_PREPARATION]); $session->setEtat($enPrepration); $this->getSessionService()->update($session); } } Loading
module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php +22 −0 Changes for module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php: 22 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ use Doctorant\Entity\Db\Doctorant; use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; use Formation\Entity\Db\Etat; use Formation\Entity\Db\Formation; use Formation\Entity\Db\Interfaces\HasTypeInterface; use Formation\Entity\Db\Session; use Individu\Entity\Db\Individu; Loading Loading @@ -163,4 +164,25 @@ class SessionRepository extends EntityRepository $result = $qb->getQuery()->getResult(); return $result; } /** * @param Formation|null $formation * @param string $champ * @param string $ordre * @param bool $keep_histo * @return array */ public function fetchSessionsByFormation(?Formation $formation, string $champ='id', string $ordre='ASC', bool $keep_histo = false) : array { $qb = $this->createQB('session') ->orderBy('session.' . $champ, $ordre); if ($formation !== null) $qb = $qb->andWhere('session.formation = :formation')->setParameter('formation', $formation); else $qb = $qb->andWhere('session.formation IS NULL'); if (!$keep_histo) $qb = $qb->andWhere('session.histoDestruction IS NULL'); $result = $qb->getQuery()->getResult(); return $result; } } No newline at end of file
module/Formation/src/Formation/Entity/Db/Session.php +1 −1 Changes for module/Formation/src/Formation/Entity/Db/Session.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ class Session implements HistoriqueAwareInterface, private ?Individu $responsable = null; private ?Etat $etat = null; private ?string $description; private ?string $description = null; private Collection $structuresComplemenaires; private Collection $seances; Loading