Loading module/Application/src/Application/Form/Poste/PosteForm.php +4 −13 Changes for module/Application/src/Application/Form/Poste/PosteForm.php: 4 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Application\Form\AutocompleteAwareTrait; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\Fonction\FonctionServiceAwareTrait; use Application\Service\RessourceRh\RessourceRhServiceAwareTrait; use Application\Service\Structure\StructureServiceAwareTrait; use DoctrineModule\Form\Element\ObjectSelect; use UnicaenApp\Form\Element\SearchAndSelect; use UnicaenApp\Service\EntityManagerAwareTrait; Loading @@ -24,6 +25,7 @@ class PosteForm extends Form { use EntityManagerAwareTrait; use FonctionServiceAwareTrait; use ServiceLocatorAwareTrait; use StructureServiceAwareTrait; use AutocompleteAwareTrait; Loading @@ -42,22 +44,11 @@ class PosteForm extends Form { ]); // structure $this->add([ 'type' => ObjectSelect::class, 'type' => Select::class, 'name' => 'structure', 'options' => [ 'label' => "Service/composante/direction d'affectation :", 'empty_option' => "Sélectionner une structure", 'object_manager' => $this->getEntityManager(), 'target_class' => Structure::class, 'property' => 'libelleLong', 'find_method' => [ 'name' => 'findBy', 'params' => [ 'criteria' => [], 'orderBy' => ['libelleCourt' => 'ASC'], ], ], 'disable_inarray_validator' => true, 'value_options' => $this->getStructureService()->getStructuresAsOptions(), ], 'attributes' => [ 'id' => 'structure', Loading module/Application/src/Application/Form/Poste/PosteFormFactory.php +4 Changes for module/Application/src/Application/Form/Poste/PosteFormFactory.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Application\Form\Poste; use Application\Service\Agent\AgentService; use Application\Service\Fonction\FonctionService; use Application\Service\RessourceRh\RessourceRhService; use Application\Service\Structure\StructureService; use Doctrine\ORM\EntityManager; use Zend\Form\FormElementManager; Loading @@ -25,11 +26,13 @@ class PosteFormFactory { * @var EntityManager $entityManager * @var AgentService $agentService * @var FonctionService $fonctionService * @var StructureService $structureService * @var RessourceRhService $ressourceService */ $entityManager = $manager->getServiceLocator()->get('doctrine.entitymanager.orm_default'); $agentService = $manager->getServiceLocator()->get(AgentService::class); $fonctionService = $manager->getServiceLocator()->get(FonctionService::class); $structureService = $manager->getServiceLocator()->get(StructureService::class); $ressourceService = $manager->getServiceLocator()->get(RessourceRhService::class); /** @var PosteHydrator $hydrator */ Loading @@ -41,6 +44,7 @@ class PosteFormFactory { $form->setEntityManager($entityManager); $form->setAgentService($agentService); $form->setFonctionService($fonctionService); $form->setStructureService($structureService); $form->setRessourceRhService($ressourceService); $form->init(); $form->setHydrator($hydrator); Loading module/Application/src/Application/Service/Structure/StructureService.php +24 −1 Changes for module/Application/src/Application/Service/Structure/StructureService.php: 24 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -228,6 +228,30 @@ class StructureService return $structure; } /** * @return array */ public function getStructuresAsOptions() { $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder('structure') ->andWhere('structure.dateFermeture IS NULL') ->andWhere('structure.histoDestruction IS NULL') ->orderBy('structure.libelleLong') ; $result = $qb->getQuery()->getResult(); $options = []; $options[null] = "Sélectionner une structure ..."; /** @var Structure $item */ foreach ($result as $item) { $options[$item->getId()] = $item->getLibelleLong(); } return $options; } public function synchroniseFromOctopus() { $structures_OCTOPUS = $this->getStructureService()->getStructures(); Loading Loading @@ -326,5 +350,4 @@ class StructureService if ($modification) $this->update($current); return $modification; } } No newline at end of file Loading
module/Application/src/Application/Form/Poste/PosteForm.php +4 −13 Changes for module/Application/src/Application/Form/Poste/PosteForm.php: 4 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use Application\Form\AutocompleteAwareTrait; use Application\Service\Agent\AgentServiceAwareTrait; use Application\Service\Fonction\FonctionServiceAwareTrait; use Application\Service\RessourceRh\RessourceRhServiceAwareTrait; use Application\Service\Structure\StructureServiceAwareTrait; use DoctrineModule\Form\Element\ObjectSelect; use UnicaenApp\Form\Element\SearchAndSelect; use UnicaenApp\Service\EntityManagerAwareTrait; Loading @@ -24,6 +25,7 @@ class PosteForm extends Form { use EntityManagerAwareTrait; use FonctionServiceAwareTrait; use ServiceLocatorAwareTrait; use StructureServiceAwareTrait; use AutocompleteAwareTrait; Loading @@ -42,22 +44,11 @@ class PosteForm extends Form { ]); // structure $this->add([ 'type' => ObjectSelect::class, 'type' => Select::class, 'name' => 'structure', 'options' => [ 'label' => "Service/composante/direction d'affectation :", 'empty_option' => "Sélectionner une structure", 'object_manager' => $this->getEntityManager(), 'target_class' => Structure::class, 'property' => 'libelleLong', 'find_method' => [ 'name' => 'findBy', 'params' => [ 'criteria' => [], 'orderBy' => ['libelleCourt' => 'ASC'], ], ], 'disable_inarray_validator' => true, 'value_options' => $this->getStructureService()->getStructuresAsOptions(), ], 'attributes' => [ 'id' => 'structure', Loading
module/Application/src/Application/Form/Poste/PosteFormFactory.php +4 Changes for module/Application/src/Application/Form/Poste/PosteFormFactory.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Application\Form\Poste; use Application\Service\Agent\AgentService; use Application\Service\Fonction\FonctionService; use Application\Service\RessourceRh\RessourceRhService; use Application\Service\Structure\StructureService; use Doctrine\ORM\EntityManager; use Zend\Form\FormElementManager; Loading @@ -25,11 +26,13 @@ class PosteFormFactory { * @var EntityManager $entityManager * @var AgentService $agentService * @var FonctionService $fonctionService * @var StructureService $structureService * @var RessourceRhService $ressourceService */ $entityManager = $manager->getServiceLocator()->get('doctrine.entitymanager.orm_default'); $agentService = $manager->getServiceLocator()->get(AgentService::class); $fonctionService = $manager->getServiceLocator()->get(FonctionService::class); $structureService = $manager->getServiceLocator()->get(StructureService::class); $ressourceService = $manager->getServiceLocator()->get(RessourceRhService::class); /** @var PosteHydrator $hydrator */ Loading @@ -41,6 +44,7 @@ class PosteFormFactory { $form->setEntityManager($entityManager); $form->setAgentService($agentService); $form->setFonctionService($fonctionService); $form->setStructureService($structureService); $form->setRessourceRhService($ressourceService); $form->init(); $form->setHydrator($hydrator); Loading
module/Application/src/Application/Service/Structure/StructureService.php +24 −1 Changes for module/Application/src/Application/Service/Structure/StructureService.php: 24 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -228,6 +228,30 @@ class StructureService return $structure; } /** * @return array */ public function getStructuresAsOptions() { $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder('structure') ->andWhere('structure.dateFermeture IS NULL') ->andWhere('structure.histoDestruction IS NULL') ->orderBy('structure.libelleLong') ; $result = $qb->getQuery()->getResult(); $options = []; $options[null] = "Sélectionner une structure ..."; /** @var Structure $item */ foreach ($result as $item) { $options[$item->getId()] = $item->getLibelleLong(); } return $options; } public function synchroniseFromOctopus() { $structures_OCTOPUS = $this->getStructureService()->getStructures(); Loading Loading @@ -326,5 +350,4 @@ class StructureService if ($modification) $this->update($current); return $modification; } } No newline at end of file