Loading module/Application/src/Application/View/Helper/partial/raisons.phtml +2 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ use Formation\Entity\Db\Formation; $class = 'raison formation'; break; case $raison instanceof Agent : $text = "Liée à l'agent <span class='highlight formation'>" . $raison->getDenomination() . "</span>"; $text = "Liée à l'agent <span class='highlight agent'>" . $raison->getDenomination(true) . "</span>"; $label = "Agent"; $class = 'agent'; break; Loading @@ -51,7 +51,7 @@ use Formation\Entity\Db\Formation; } ?> <span class="raison <?php echo $class; ?>" title="<?php echo $text; ?>" ><?php echo $label; ?></span> <span data-bs-toggle='tooltip' data-bs-html='true' class="raison <?php echo $class; ?>" title="<?php echo $text; ?>" ><?php echo $label; ?></span> <?php endforeach;?> <?php endif; ?> Loading module/Element/src/Element/Controller/ApplicationController.php +5 −0 Original line number Diff line number Diff line Loading @@ -164,9 +164,14 @@ class ApplicationController extends AbstractActionController { { $application = $this->getApplicationService()->getRequestedApplication($this, 'id'); $agents = $this->getApplicationElementService()->getAgentsHavingApplicationFromAgent($application); $fichesmetiers = $this->getApplicationElementService()->getFicheMetierHavingApplication($application); return new ViewModel([ 'title' => "Description de l'application", 'application' => $application, 'agents' => $agents, 'fichesmetiers' => $fichesmetiers, ]); } Loading module/Element/src/Element/Controller/CompetenceController.php +2 −0 Original line number Diff line number Diff line Loading @@ -52,11 +52,13 @@ class CompetenceController extends AbstractActionController public function afficherAction() : ViewModel { $competence = $this->getCompetenceService()->getRequestedCompetence($this); $agents = $this->getCompetenceElementService()->getAgentsHavinCompetenceFromAgent($competence); $missions = $this->getMissionPrincipaleService()->getMissionsHavingCompetence($competence); $fiches = $this->getFicheMetierService()->getFichesMetiersByCompetence($competence); return new ViewModel([ 'title' => "Affiche d'une compétence", 'competence' => $competence, 'agents' => $agents, 'missions' => $missions, 'fiches' => $fiches, ]); Loading module/Element/src/Element/Service/ApplicationElement/ApplicationElementService.php +37 −31 Original line number Diff line number Diff line Loading @@ -2,70 +2,53 @@ namespace Element\Service\ApplicationElement; use Application\Entity\Db\Agent; use DoctrineModule\Persistence\ProvidesObjectManager; use Element\Entity\Db\Application; use Element\Entity\Db\ApplicationElement; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\Exception\ORMException; use Doctrine\ORM\QueryBuilder; use FicheMetier\Entity\Db\FicheMetier; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; class ApplicationElementService { use EntityManagerAwareTrait; use ProvidesObjectManager; /** Gestion des entites ***************************************************************************************/ public function create(ApplicationElement $element) : ApplicationElement { try { $this->getEntityManager()->persist($element); $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->persist($element); $this->getObjectManager()->flush($element); return $element; } public function update(ApplicationElement $element) : ApplicationElement { try { $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->flush($element); return $element; } public function historise(ApplicationElement $element) : ApplicationElement { try { $element->historiser(); $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->flush($element); return $element; } public function restore(ApplicationElement $element) : ApplicationElement { try { $element->dehistoriser(); $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->flush($element); return $element; } public function delete(ApplicationElement $element) : ApplicationElement { try { $this->getEntityManager()->remove($element); $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->remove($element); $this->getObjectManager()->flush($element); return $element; } Loading @@ -73,7 +56,7 @@ class ApplicationElementService { public function createQueryBuilder() : QueryBuilder { $qb = $this->getEntityManager()->getRepository(ApplicationElement::class)->createQueryBuilder('applicationelement') $qb = $this->getObjectManager()->getRepository(ApplicationElement::class)->createQueryBuilder('applicationelement') ->addSelect('application')->join('applicationelement.application', 'application') ; return $qb; Loading @@ -88,7 +71,7 @@ class ApplicationElementService { try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs ApplicationElement partagent le même id [".$id."]"); throw new RuntimeException("Plusieurs ApplicationElement partagent le même id [".$id."]", 0 , $e); } return $result; } Loading @@ -99,4 +82,27 @@ class ApplicationElementService { return $this->getApplicationElement($id); } /** FACADE ********************************************************************************************************/ /** @return Agent[] */ public function getAgentsHavingApplicationFromAgent(Application $application): array { $qb = $this->getObjectManager()->getRepository(Agent::class)->createQueryBuilder("agent") ->join('agent.applications', 'applicationelement')->addSelect('applicationelement') ->andWhere('applicationelement.application = :application')->setParameter('application', $application) ->andWhere('applicationelement.histoDestruction IS NULL') ; return $qb->getQuery()->getResult(); } /** @return FicheMetier[] */ public function getFicheMetierHavingApplication(Application $application): array { $qb = $this->getObjectManager()->getRepository(FicheMetier::class)->createQueryBuilder("fichemetier") ->join('fichemetier.applications', 'applicationelement')->addSelect('applicationelement') ->andWhere('applicationelement.application = :application')->setParameter('application', $application) ->andWhere('applicationelement.histoDestruction IS NULL') ; return $qb->getQuery()->getResult(); } } No newline at end of file module/Element/src/Element/Service/ApplicationElement/ApplicationElementServiceFactory.php +3 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,8 @@ use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; class ApplicationElementServiceFactory { class ApplicationElementServiceFactory { /** * @param ContainerInterface $container Loading @@ -23,7 +24,7 @@ class ApplicationElementServiceFactory { $entityManager = $container->get('doctrine.entitymanager.orm_default'); $service = new ApplicationElementService(); $service->setEntityManager($entityManager); $service->setObjectManager($entityManager); return $service; } } No newline at end of file Loading
module/Application/src/Application/View/Helper/partial/raisons.phtml +2 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ use Formation\Entity\Db\Formation; $class = 'raison formation'; break; case $raison instanceof Agent : $text = "Liée à l'agent <span class='highlight formation'>" . $raison->getDenomination() . "</span>"; $text = "Liée à l'agent <span class='highlight agent'>" . $raison->getDenomination(true) . "</span>"; $label = "Agent"; $class = 'agent'; break; Loading @@ -51,7 +51,7 @@ use Formation\Entity\Db\Formation; } ?> <span class="raison <?php echo $class; ?>" title="<?php echo $text; ?>" ><?php echo $label; ?></span> <span data-bs-toggle='tooltip' data-bs-html='true' class="raison <?php echo $class; ?>" title="<?php echo $text; ?>" ><?php echo $label; ?></span> <?php endforeach;?> <?php endif; ?> Loading
module/Element/src/Element/Controller/ApplicationController.php +5 −0 Original line number Diff line number Diff line Loading @@ -164,9 +164,14 @@ class ApplicationController extends AbstractActionController { { $application = $this->getApplicationService()->getRequestedApplication($this, 'id'); $agents = $this->getApplicationElementService()->getAgentsHavingApplicationFromAgent($application); $fichesmetiers = $this->getApplicationElementService()->getFicheMetierHavingApplication($application); return new ViewModel([ 'title' => "Description de l'application", 'application' => $application, 'agents' => $agents, 'fichesmetiers' => $fichesmetiers, ]); } Loading
module/Element/src/Element/Controller/CompetenceController.php +2 −0 Original line number Diff line number Diff line Loading @@ -52,11 +52,13 @@ class CompetenceController extends AbstractActionController public function afficherAction() : ViewModel { $competence = $this->getCompetenceService()->getRequestedCompetence($this); $agents = $this->getCompetenceElementService()->getAgentsHavinCompetenceFromAgent($competence); $missions = $this->getMissionPrincipaleService()->getMissionsHavingCompetence($competence); $fiches = $this->getFicheMetierService()->getFichesMetiersByCompetence($competence); return new ViewModel([ 'title' => "Affiche d'une compétence", 'competence' => $competence, 'agents' => $agents, 'missions' => $missions, 'fiches' => $fiches, ]); Loading
module/Element/src/Element/Service/ApplicationElement/ApplicationElementService.php +37 −31 Original line number Diff line number Diff line Loading @@ -2,70 +2,53 @@ namespace Element\Service\ApplicationElement; use Application\Entity\Db\Agent; use DoctrineModule\Persistence\ProvidesObjectManager; use Element\Entity\Db\Application; use Element\Entity\Db\ApplicationElement; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\Exception\ORMException; use Doctrine\ORM\QueryBuilder; use FicheMetier\Entity\Db\FicheMetier; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; class ApplicationElementService { use EntityManagerAwareTrait; use ProvidesObjectManager; /** Gestion des entites ***************************************************************************************/ public function create(ApplicationElement $element) : ApplicationElement { try { $this->getEntityManager()->persist($element); $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->persist($element); $this->getObjectManager()->flush($element); return $element; } public function update(ApplicationElement $element) : ApplicationElement { try { $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->flush($element); return $element; } public function historise(ApplicationElement $element) : ApplicationElement { try { $element->historiser(); $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->flush($element); return $element; } public function restore(ApplicationElement $element) : ApplicationElement { try { $element->dehistoriser(); $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->flush($element); return $element; } public function delete(ApplicationElement $element) : ApplicationElement { try { $this->getEntityManager()->remove($element); $this->getEntityManager()->flush($element); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue lors de l'enregistrement en BD.", $e); } $this->getObjectManager()->remove($element); $this->getObjectManager()->flush($element); return $element; } Loading @@ -73,7 +56,7 @@ class ApplicationElementService { public function createQueryBuilder() : QueryBuilder { $qb = $this->getEntityManager()->getRepository(ApplicationElement::class)->createQueryBuilder('applicationelement') $qb = $this->getObjectManager()->getRepository(ApplicationElement::class)->createQueryBuilder('applicationelement') ->addSelect('application')->join('applicationelement.application', 'application') ; return $qb; Loading @@ -88,7 +71,7 @@ class ApplicationElementService { try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs ApplicationElement partagent le même id [".$id."]"); throw new RuntimeException("Plusieurs ApplicationElement partagent le même id [".$id."]", 0 , $e); } return $result; } Loading @@ -99,4 +82,27 @@ class ApplicationElementService { return $this->getApplicationElement($id); } /** FACADE ********************************************************************************************************/ /** @return Agent[] */ public function getAgentsHavingApplicationFromAgent(Application $application): array { $qb = $this->getObjectManager()->getRepository(Agent::class)->createQueryBuilder("agent") ->join('agent.applications', 'applicationelement')->addSelect('applicationelement') ->andWhere('applicationelement.application = :application')->setParameter('application', $application) ->andWhere('applicationelement.histoDestruction IS NULL') ; return $qb->getQuery()->getResult(); } /** @return FicheMetier[] */ public function getFicheMetierHavingApplication(Application $application): array { $qb = $this->getObjectManager()->getRepository(FicheMetier::class)->createQueryBuilder("fichemetier") ->join('fichemetier.applications', 'applicationelement')->addSelect('applicationelement') ->andWhere('applicationelement.application = :application')->setParameter('application', $application) ->andWhere('applicationelement.histoDestruction IS NULL') ; return $qb->getQuery()->getResult(); } } No newline at end of file
module/Element/src/Element/Service/ApplicationElement/ApplicationElementServiceFactory.php +3 −2 Original line number Diff line number Diff line Loading @@ -7,7 +7,8 @@ use Interop\Container\ContainerInterface; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; class ApplicationElementServiceFactory { class ApplicationElementServiceFactory { /** * @param ContainerInterface $container Loading @@ -23,7 +24,7 @@ class ApplicationElementServiceFactory { $entityManager = $container->get('doctrine.entitymanager.orm_default'); $service = new ApplicationElementService(); $service->setEntityManager($entityManager); $service->setObjectManager($entityManager); return $service; } } No newline at end of file