Loading module/Application/src/Application/Service/FichePoste/FichePosteService.php +3 −6 Original line number Diff line number Diff line Loading @@ -153,7 +153,6 @@ class FichePosteService { throw new RuntimeException("Un problème est survenu lors de la création du QueryBuilder de [".FichePoste::class."]",0,$e); } $qb = FichePoste::decorateWithEtats($qb, 'fiche'); return $qb; } Loading Loading @@ -226,11 +225,9 @@ class FichePosteService { ->setParameter('agent', $agent) ->andWhere('fiche.histoCreation <= :date') ->andWhere('fiche.histoDestruction IS NULL OR fiche.histoDestruction >= :date') ->andWhere('type.code = :OK AND type.code = :SIGNEE') ->setParameter('date', $date) ->setParameter('OK', FichePosteEtats::ETAT_CODE_OK) ->setParameter('SIGNEE', FichePosteEtats::ETAT_CODE_SIGNEE) ; $qb = FichePoste::decorateWithEtatsCodes($qb, 'fiche', [FichePosteEtats::ETAT_CODE_OK, FichePosteEtats::ETAT_CODE_SIGNEE]); try { $result = $qb->getQuery()->getOneOrNullResult(); } catch(NonUniqueResultException $e) { Loading Loading @@ -874,9 +871,9 @@ EOS; $qb = $this->createQueryBuilder() ->andWhere('fiche.finValidite IS NULL') ->andWhere('fiche.agent = :agent') ->andWhere('etat.code = :SIGNE') ->setParameter('agent', $agent) ->setParameter('SIGNE', FichePosteEtats::ETAT_CODE_SIGNEE); ; $qb = FichePoste::decorateWithEtatsCodes($qb, 'fiche', [FichePosteEtats::ETAT_CODE_SIGNEE]); $result = $qb->getQuery()->getResult(); return $result; Loading module/Formation/src/Formation/Service/Abonnement/AbonnementService.php +15 −41 Original line number Diff line number Diff line Loading @@ -4,74 +4,51 @@ namespace Formation\Service\Abonnement; use Application\Entity\Db\Agent; use DateTime; use Doctrine\ORM\Exception\NotSupported; use Doctrine\ORM\Exception\ORMException; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; use Formation\Entity\Db\Formation; use Formation\Entity\Db\FormationAbonnement; use Laminas\Mvc\Controller\AbstractActionController; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenIndicateur\Entity\Db\Abonnement; class AbonnementService { use EntityManagerAwareTrait; use ProvidesObjectManager; /** Gestion des entités ***************************************************************/ public function create(FormationAbonnement $abonnement): FormationAbonnement { try { $this->getEntityManager()->persist($abonnement); $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->persist($abonnement); $this->getObjectManager()->flush($abonnement); return $abonnement; } public function update(FormationAbonnement $abonnement): FormationAbonnement { try { $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->flush($abonnement); return $abonnement; } public function historise(FormationAbonnement $abonnement): FormationAbonnement { try { $abonnement->historiser(); $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->flush($abonnement); return $abonnement; } public function restore(FormationAbonnement $abonnement): FormationAbonnement { try { $abonnement->dehistoriser(); $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->flush($abonnement); return $abonnement; } public function delete(FormationAbonnement $abonnement): FormationAbonnement { try { $this->getEntityManager()->remove($abonnement); $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->remove($abonnement); $this->getObjectManager()->flush($abonnement); return $abonnement; } Loading @@ -79,13 +56,10 @@ class AbonnementService public function createQueryBuilder(): QueryBuilder { try { $qb = $this->getEntityManager()->getRepository(FormationAbonnement::class)->createQueryBuilder('abonnement') $qb = $this->getObjectManager()->getRepository(FormationAbonnement::class)->createQueryBuilder('abonnement') ->join('abonnement.agent', 'agent')->addSelect('agent') ->join('abonnement.formation', 'formation')->addSelect('formation'); } catch (NotSupported $e) { throw new RuntimeException("Un problème est survenu lors de la création du QueryBuilder de [".Abonnement::class."]", 0 ,$e); } ->join('abonnement.formation', 'formation')->addSelect('formation') ; return $qb; } Loading module/Formation/src/Formation/Service/Abonnement/AbonnementServiceFactory.php +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ class AbonnementServiceFactory { $entityManager = $container->get('doctrine.entitymanager.orm_default'); $service = new AbonnementService(); $service->setEntityManager($entityManager); $service->setObjectManager($entityManager); return $service; } } No newline at end of file module/Formation/src/Formation/Service/DemandeExterne/DemandeExterneService.php +67 −92 Original line number Diff line number Diff line Loading @@ -5,15 +5,13 @@ namespace Formation\Service\DemandeExterne; use Application\Entity\Db\Agent; use Application\Entity\Db\Interfaces\HasSourceInterface; use DateTime; use Doctrine\ORM\Exception\NotSupported; use Doctrine\ORM\Exception\ORMException; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; use Formation\Entity\Db\DemandeExterne; use Formation\Entity\Db\Formation; use Formation\Entity\Db\FormationGroupe; use Formation\Entity\Db\FormationInstance; use Formation\Entity\Db\FormationInstanceInscrit; use Formation\Entity\Db\Inscription; use Formation\Entity\Db\Presence; use Formation\Entity\Db\Seance; Loading @@ -30,7 +28,6 @@ use Laminas\Mvc\Controller\AbstractActionController; use Structure\Entity\Db\Structure; use Structure\Service\Structure\StructureServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenEtat\Entity\Db\EtatType; use UnicaenEtat\Service\EtatInstance\EtatInstanceServiceAwareTrait; use UnicaenEtat\Service\EtatType\EtatTypeServiceAwareTrait; Loading @@ -39,7 +36,7 @@ use UnicaenValidation\Service\ValidationType\ValidationTypeServiceAwareTrait; class DemandeExterneService { use EntityManagerAwareTrait; use ProvidesObjectManager; use EtatInstanceServiceAwareTrait; use EtatTypeServiceAwareTrait; use FormationServiceAwareTrait; Loading @@ -57,55 +54,35 @@ class DemandeExterneService public function create(DemandeExterne $demande): DemandeExterne { try { $this->getEntityManager()->persist($demande); $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->persist($demande); $this->getObjectManager()->flush($demande); return $demande; } public function update(DemandeExterne $demande): DemandeExterne { try { $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->flush($demande); return $demande; } public function historise(DemandeExterne $demande): DemandeExterne { try { $demande->historiser(); $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->flush($demande); return $demande; } public function restore(DemandeExterne $demande): DemandeExterne { try { $demande->dehistoriser(); $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->flush($demande); return $demande; } public function delete(DemandeExterne $demande): DemandeExterne { try { $this->getEntityManager()->remove($demande); $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->remove($demande); $this->getObjectManager()->flush($demande); return $demande; } Loading @@ -113,16 +90,12 @@ class DemandeExterneService public function createQueryBuilder(): QueryBuilder { try { $qb = $this->getEntityManager()->getRepository(DemandeExterne::class)->createQueryBuilder('demande') $qb = $this->getObjectManager()->getRepository(DemandeExterne::class)->createQueryBuilder('demande') ->join('demande.agent', 'agent')->addSelect('agent') ->join('demande.etats', 'etat')->addSelect('etat') ->join('etat.type', 'type')->addSelect('type') ->andWhere('etat.histoDestruction IS NULL') ; } catch (NotSupported $e) { throw new RuntimeException("Un problème est survenu lors de la création du QueryBuilder de [" . DemandeExterne::class . "]", 0, $e); } return $qb; } Loading Loading @@ -204,8 +177,6 @@ class DemandeExterneService return $result; } /** FACADE ********************************************************************************************************/ /** * @param Structure $structure * @param bool $avecStructuresFilles Loading Loading @@ -255,7 +226,7 @@ class DemandeExterneService ->andWhere('demande.agent in (:agents)')->setParameter('agents', $agents) ->andWhere('demande.histoCreation >= :debut')->setParameter('debut', $debut) ->andWhere('demande.histoCreation <= :fin')->setParameter('fin', $fin); /** @var FormationInstanceInscrit[] $result */ /** @var Inscription[] $result */ $result = $qb->getQuery()->getResult(); $inscriptions = []; Loading Loading @@ -307,6 +278,55 @@ class DemandeExterneService return $organismes; } /** * @param Agent[] $agents * @param EtatType[] $etats * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesValideesByAgentsAndEtats(array $agents, array $etats, ?int $annee): array { if ($annee === null) Formation::getAnnee(); $debut = DateTime::createFromFormat('d/m/Y', '01/09/' . $annee); $fin = DateTime::createFromFormat('d/m/Y', '31/08/' . ($annee + 1)); $qb = $this->createQueryBuilder() ->andWhere('demande.histoDestruction IS NULL') ->andWhere('type.code in (:etats)')->setParameter('etats', $etats) ->andWhere('demande.debut > :debut')->setParameter('debut', $debut) ->andWhere('demande.debut < :fin')->setParameter('fin', $fin) ->andWhere('agent in (:agents)')->setParameter('agents', $agents); $result = $qb->getQuery()->getResult(); return $result; } /** * @param Agent[] $agents * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesValideesByAgents(array $agents, ?int $annee): array { $etats = [DemandeExterneEtats::ETAT_VALIDATION_DRH, DemandeExterneEtats::ETAT_REJETEE, DemandeExterneEtats::ETAT_TERMINEE]; $result = $this->getDemandesExternesValideesByAgentsAndEtats($agents, $etats, $annee); return $result; } /** * @param Agent[] $agents * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesNonValideesByAgents(array $agents, ?int $annee): array { $etats = [DemandeExterneEtats::ETAT_VALIDATION_AGENT, DemandeExterneEtats::ETAT_VALIDATION_RESP]; $result = $this->getDemandesExternesValideesByAgentsAndEtats($agents, $etats, $annee); return $result; } /** FACADE ********************************************************************************************************/ public function transformer(?DemandeExterne $demande, string $libelle, float $volume, float $suivi): FormationInstance { //theme Loading Loading @@ -404,50 +424,5 @@ class DemandeExterneService return $session; } /** * @param Agent[] $agents * @param EtatType[] $etats * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesValideesByAgentsAndEtats(array $agents, array $etats, ?int $annee): array { if ($annee === null) Formation::getAnnee(); $debut = DateTime::createFromFormat('d/m/Y', '01/09/' . $annee); $fin = DateTime::createFromFormat('d/m/Y', '31/08/' . ($annee + 1)); $qb = $this->createQueryBuilder() ->andWhere('demande.histoDestruction IS NULL') ->andWhere('type.code in (:etats)')->setParameter('etats', $etats) ->andWhere('demande.debut > :debut')->setParameter('debut', $debut) ->andWhere('demande.debut < :fin')->setParameter('fin', $fin) ->andWhere('agent in (:agents)')->setParameter('agents', $agents); $result = $qb->getQuery()->getResult(); return $result; } /** * @param Agent[] $agents * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesValideesByAgents(array $agents, ?int $annee): array { $etats = [DemandeExterneEtats::ETAT_VALIDATION_DRH, DemandeExterneEtats::ETAT_REJETEE, DemandeExterneEtats::ETAT_TERMINEE]; $result = $this->getDemandesExternesValideesByAgentsAndEtats($agents, $etats, $annee); return $result; } /** * @param Agent[] $agents * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesNonValideesByAgents(array $agents, ?int $annee): array { $etats = [DemandeExterneEtats::ETAT_VALIDATION_AGENT, DemandeExterneEtats::ETAT_VALIDATION_RESP]; $result = $this->getDemandesExternesValideesByAgentsAndEtats($agents, $etats, $annee); return $result; } } No newline at end of file module/Formation/src/Formation/Service/DemandeExterne/DemandeExterneServiceFactory.php +1 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ class DemandeExterneServiceFactory $validationTypeService = $container->get(ValidationTypeService::class); $service = new DemandeExterneService(); $service->setEntityManager($entityManager); $service->setObjectManager($entityManager); $service->setEtatInstanceService($etatInstanceService); $service->setEtatTypeService($etatTypeService); $service->setFormationService($formationService); Loading Loading
module/Application/src/Application/Service/FichePoste/FichePosteService.php +3 −6 Original line number Diff line number Diff line Loading @@ -153,7 +153,6 @@ class FichePosteService { throw new RuntimeException("Un problème est survenu lors de la création du QueryBuilder de [".FichePoste::class."]",0,$e); } $qb = FichePoste::decorateWithEtats($qb, 'fiche'); return $qb; } Loading Loading @@ -226,11 +225,9 @@ class FichePosteService { ->setParameter('agent', $agent) ->andWhere('fiche.histoCreation <= :date') ->andWhere('fiche.histoDestruction IS NULL OR fiche.histoDestruction >= :date') ->andWhere('type.code = :OK AND type.code = :SIGNEE') ->setParameter('date', $date) ->setParameter('OK', FichePosteEtats::ETAT_CODE_OK) ->setParameter('SIGNEE', FichePosteEtats::ETAT_CODE_SIGNEE) ; $qb = FichePoste::decorateWithEtatsCodes($qb, 'fiche', [FichePosteEtats::ETAT_CODE_OK, FichePosteEtats::ETAT_CODE_SIGNEE]); try { $result = $qb->getQuery()->getOneOrNullResult(); } catch(NonUniqueResultException $e) { Loading Loading @@ -874,9 +871,9 @@ EOS; $qb = $this->createQueryBuilder() ->andWhere('fiche.finValidite IS NULL') ->andWhere('fiche.agent = :agent') ->andWhere('etat.code = :SIGNE') ->setParameter('agent', $agent) ->setParameter('SIGNE', FichePosteEtats::ETAT_CODE_SIGNEE); ; $qb = FichePoste::decorateWithEtatsCodes($qb, 'fiche', [FichePosteEtats::ETAT_CODE_SIGNEE]); $result = $qb->getQuery()->getResult(); return $result; Loading
module/Formation/src/Formation/Service/Abonnement/AbonnementService.php +15 −41 Original line number Diff line number Diff line Loading @@ -4,74 +4,51 @@ namespace Formation\Service\Abonnement; use Application\Entity\Db\Agent; use DateTime; use Doctrine\ORM\Exception\NotSupported; use Doctrine\ORM\Exception\ORMException; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; use Formation\Entity\Db\Formation; use Formation\Entity\Db\FormationAbonnement; use Laminas\Mvc\Controller\AbstractActionController; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenIndicateur\Entity\Db\Abonnement; class AbonnementService { use EntityManagerAwareTrait; use ProvidesObjectManager; /** Gestion des entités ***************************************************************/ public function create(FormationAbonnement $abonnement): FormationAbonnement { try { $this->getEntityManager()->persist($abonnement); $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->persist($abonnement); $this->getObjectManager()->flush($abonnement); return $abonnement; } public function update(FormationAbonnement $abonnement): FormationAbonnement { try { $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->flush($abonnement); return $abonnement; } public function historise(FormationAbonnement $abonnement): FormationAbonnement { try { $abonnement->historiser(); $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->flush($abonnement); return $abonnement; } public function restore(FormationAbonnement $abonnement): FormationAbonnement { try { $abonnement->dehistoriser(); $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->flush($abonnement); return $abonnement; } public function delete(FormationAbonnement $abonnement): FormationAbonnement { try { $this->getEntityManager()->remove($abonnement); $this->getEntityManager()->flush($abonnement); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenu en base de donnée", 0, $e); } $this->getObjectManager()->remove($abonnement); $this->getObjectManager()->flush($abonnement); return $abonnement; } Loading @@ -79,13 +56,10 @@ class AbonnementService public function createQueryBuilder(): QueryBuilder { try { $qb = $this->getEntityManager()->getRepository(FormationAbonnement::class)->createQueryBuilder('abonnement') $qb = $this->getObjectManager()->getRepository(FormationAbonnement::class)->createQueryBuilder('abonnement') ->join('abonnement.agent', 'agent')->addSelect('agent') ->join('abonnement.formation', 'formation')->addSelect('formation'); } catch (NotSupported $e) { throw new RuntimeException("Un problème est survenu lors de la création du QueryBuilder de [".Abonnement::class."]", 0 ,$e); } ->join('abonnement.formation', 'formation')->addSelect('formation') ; return $qb; } Loading
module/Formation/src/Formation/Service/Abonnement/AbonnementServiceFactory.php +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ class AbonnementServiceFactory { $entityManager = $container->get('doctrine.entitymanager.orm_default'); $service = new AbonnementService(); $service->setEntityManager($entityManager); $service->setObjectManager($entityManager); return $service; } } No newline at end of file
module/Formation/src/Formation/Service/DemandeExterne/DemandeExterneService.php +67 −92 Original line number Diff line number Diff line Loading @@ -5,15 +5,13 @@ namespace Formation\Service\DemandeExterne; use Application\Entity\Db\Agent; use Application\Entity\Db\Interfaces\HasSourceInterface; use DateTime; use Doctrine\ORM\Exception\NotSupported; use Doctrine\ORM\Exception\ORMException; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\QueryBuilder; use DoctrineModule\Persistence\ProvidesObjectManager; use Formation\Entity\Db\DemandeExterne; use Formation\Entity\Db\Formation; use Formation\Entity\Db\FormationGroupe; use Formation\Entity\Db\FormationInstance; use Formation\Entity\Db\FormationInstanceInscrit; use Formation\Entity\Db\Inscription; use Formation\Entity\Db\Presence; use Formation\Entity\Db\Seance; Loading @@ -30,7 +28,6 @@ use Laminas\Mvc\Controller\AbstractActionController; use Structure\Entity\Db\Structure; use Structure\Service\Structure\StructureServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenEtat\Entity\Db\EtatType; use UnicaenEtat\Service\EtatInstance\EtatInstanceServiceAwareTrait; use UnicaenEtat\Service\EtatType\EtatTypeServiceAwareTrait; Loading @@ -39,7 +36,7 @@ use UnicaenValidation\Service\ValidationType\ValidationTypeServiceAwareTrait; class DemandeExterneService { use EntityManagerAwareTrait; use ProvidesObjectManager; use EtatInstanceServiceAwareTrait; use EtatTypeServiceAwareTrait; use FormationServiceAwareTrait; Loading @@ -57,55 +54,35 @@ class DemandeExterneService public function create(DemandeExterne $demande): DemandeExterne { try { $this->getEntityManager()->persist($demande); $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->persist($demande); $this->getObjectManager()->flush($demande); return $demande; } public function update(DemandeExterne $demande): DemandeExterne { try { $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->flush($demande); return $demande; } public function historise(DemandeExterne $demande): DemandeExterne { try { $demande->historiser(); $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->flush($demande); return $demande; } public function restore(DemandeExterne $demande): DemandeExterne { try { $demande->dehistoriser(); $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->flush($demande); return $demande; } public function delete(DemandeExterne $demande): DemandeExterne { try { $this->getEntityManager()->remove($demande); $this->getEntityManager()->flush($demande); } catch (ORMException $e) { throw new RuntimeException("Un problème est survenue en BD.", 0, $e); } $this->getObjectManager()->remove($demande); $this->getObjectManager()->flush($demande); return $demande; } Loading @@ -113,16 +90,12 @@ class DemandeExterneService public function createQueryBuilder(): QueryBuilder { try { $qb = $this->getEntityManager()->getRepository(DemandeExterne::class)->createQueryBuilder('demande') $qb = $this->getObjectManager()->getRepository(DemandeExterne::class)->createQueryBuilder('demande') ->join('demande.agent', 'agent')->addSelect('agent') ->join('demande.etats', 'etat')->addSelect('etat') ->join('etat.type', 'type')->addSelect('type') ->andWhere('etat.histoDestruction IS NULL') ; } catch (NotSupported $e) { throw new RuntimeException("Un problème est survenu lors de la création du QueryBuilder de [" . DemandeExterne::class . "]", 0, $e); } return $qb; } Loading Loading @@ -204,8 +177,6 @@ class DemandeExterneService return $result; } /** FACADE ********************************************************************************************************/ /** * @param Structure $structure * @param bool $avecStructuresFilles Loading Loading @@ -255,7 +226,7 @@ class DemandeExterneService ->andWhere('demande.agent in (:agents)')->setParameter('agents', $agents) ->andWhere('demande.histoCreation >= :debut')->setParameter('debut', $debut) ->andWhere('demande.histoCreation <= :fin')->setParameter('fin', $fin); /** @var FormationInstanceInscrit[] $result */ /** @var Inscription[] $result */ $result = $qb->getQuery()->getResult(); $inscriptions = []; Loading Loading @@ -307,6 +278,55 @@ class DemandeExterneService return $organismes; } /** * @param Agent[] $agents * @param EtatType[] $etats * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesValideesByAgentsAndEtats(array $agents, array $etats, ?int $annee): array { if ($annee === null) Formation::getAnnee(); $debut = DateTime::createFromFormat('d/m/Y', '01/09/' . $annee); $fin = DateTime::createFromFormat('d/m/Y', '31/08/' . ($annee + 1)); $qb = $this->createQueryBuilder() ->andWhere('demande.histoDestruction IS NULL') ->andWhere('type.code in (:etats)')->setParameter('etats', $etats) ->andWhere('demande.debut > :debut')->setParameter('debut', $debut) ->andWhere('demande.debut < :fin')->setParameter('fin', $fin) ->andWhere('agent in (:agents)')->setParameter('agents', $agents); $result = $qb->getQuery()->getResult(); return $result; } /** * @param Agent[] $agents * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesValideesByAgents(array $agents, ?int $annee): array { $etats = [DemandeExterneEtats::ETAT_VALIDATION_DRH, DemandeExterneEtats::ETAT_REJETEE, DemandeExterneEtats::ETAT_TERMINEE]; $result = $this->getDemandesExternesValideesByAgentsAndEtats($agents, $etats, $annee); return $result; } /** * @param Agent[] $agents * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesNonValideesByAgents(array $agents, ?int $annee): array { $etats = [DemandeExterneEtats::ETAT_VALIDATION_AGENT, DemandeExterneEtats::ETAT_VALIDATION_RESP]; $result = $this->getDemandesExternesValideesByAgentsAndEtats($agents, $etats, $annee); return $result; } /** FACADE ********************************************************************************************************/ public function transformer(?DemandeExterne $demande, string $libelle, float $volume, float $suivi): FormationInstance { //theme Loading Loading @@ -404,50 +424,5 @@ class DemandeExterneService return $session; } /** * @param Agent[] $agents * @param EtatType[] $etats * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesValideesByAgentsAndEtats(array $agents, array $etats, ?int $annee): array { if ($annee === null) Formation::getAnnee(); $debut = DateTime::createFromFormat('d/m/Y', '01/09/' . $annee); $fin = DateTime::createFromFormat('d/m/Y', '31/08/' . ($annee + 1)); $qb = $this->createQueryBuilder() ->andWhere('demande.histoDestruction IS NULL') ->andWhere('type.code in (:etats)')->setParameter('etats', $etats) ->andWhere('demande.debut > :debut')->setParameter('debut', $debut) ->andWhere('demande.debut < :fin')->setParameter('fin', $fin) ->andWhere('agent in (:agents)')->setParameter('agents', $agents); $result = $qb->getQuery()->getResult(); return $result; } /** * @param Agent[] $agents * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesValideesByAgents(array $agents, ?int $annee): array { $etats = [DemandeExterneEtats::ETAT_VALIDATION_DRH, DemandeExterneEtats::ETAT_REJETEE, DemandeExterneEtats::ETAT_TERMINEE]; $result = $this->getDemandesExternesValideesByAgentsAndEtats($agents, $etats, $annee); return $result; } /** * @param Agent[] $agents * @param int|null $annee * @return DemandeExterne[] */ public function getDemandesExternesNonValideesByAgents(array $agents, ?int $annee): array { $etats = [DemandeExterneEtats::ETAT_VALIDATION_AGENT, DemandeExterneEtats::ETAT_VALIDATION_RESP]; $result = $this->getDemandesExternesValideesByAgentsAndEtats($agents, $etats, $annee); return $result; } } No newline at end of file
module/Formation/src/Formation/Service/DemandeExterne/DemandeExterneServiceFactory.php +1 −1 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ class DemandeExterneServiceFactory $validationTypeService = $container->get(ValidationTypeService::class); $service = new DemandeExterneService(); $service->setEntityManager($entityManager); $service->setObjectManager($entityManager); $service->setEtatInstanceService($etatInstanceService); $service->setEtatTypeService($etatTypeService); $service->setFormationService($formationService); Loading