Loading module/Application/src/Application/Controller/TheseController.php +1 −1 Changes for module/Application/src/Application/Controller/TheseController.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ class TheseController extends AbstractController } $this->theseRechercheService ->createFilters() ->createFiltersWithUnpopulatedOptions() ->createSorters() ->processQueryParams($queryParams); Loading module/Application/src/Application/Entity/Db/Repository/TheseRepository.php +18 −2 Changes for module/Application/src/Application/Entity/Db/Repository/TheseRepository.php: 18 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,9 +2,11 @@ namespace Application\Entity\Db\Repository; use Application\Entity\Db\Etablissement; use Application\Entity\Db\These; use Application\ORM\Query\Functions\Year; use Application\QueryBuilder\TheseQueryBuilder; use Doctrine\ORM\Query\Expr\Join; /** * @method TheseQueryBuilder createQueryBuilder($alias, $indexBy = null) Loading Loading @@ -35,10 +37,11 @@ class TheseRepository extends DefaultEntityRepository } /** * @param Etablissement|null $etablissement * @return int[] * @see Year */ public function fetchDistinctAnneesPremiereInscription() public function fetchDistinctAnneesPremiereInscription(Etablissement $etablissement = null) { $qb = $this->createQueryBuilder('t'); $qb Loading @@ -46,6 +49,12 @@ class TheseRepository extends DefaultEntityRepository ->select("year(t.datePremiereInscription)") ->orderBy("year(t.datePremiereInscription)"); if ($etablissement !== null) { $qb ->join('t.etablissement', 'etab', Join::WITH, 'etab = :etablissement') ->setParameter('etablissement', $etablissement); } $results = array_map(function($value) { return current($value); }, $qb->getQuery()->getScalarResult()); Loading @@ -54,9 +63,10 @@ class TheseRepository extends DefaultEntityRepository } /** * @param Etablissement|null $etablissement * @return string[] */ public function fetchDistinctDisciplines() public function fetchDistinctDisciplines(Etablissement $etablissement = null) { $qb = $this->createQueryBuilder('t'); $qb Loading @@ -64,6 +74,12 @@ class TheseRepository extends DefaultEntityRepository ->select("t.libelleDiscipline") ->orderBy("t.libelleDiscipline"); if ($etablissement !== null) { $qb ->join('t.etablissement', 'etab', Join::WITH, 'etab = :etablissement') ->setParameter('etablissement', $etablissement); } $results = array_map(function($value) { return current($value); }, $qb->getQuery()->getScalarResult()); Loading module/Application/src/Application/Entity/Db/Structure.php +18 −6 Changes for module/Application/src/Application/Entity/Db/Structure.php: 18 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Application\Entity\Db; use Doctrine\Common\Collections\Collection; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenApp\Exception\LogicException; Loading Loading @@ -45,8 +46,19 @@ class Structure implements HistoriqueAwareInterface, SourceAwareInterface */ protected $typeStructure; /** * @var Collection */ protected $etablissement; /** * @var Collection */ protected $ecoleDoctorale; /** * @var Collection */ protected $uniteRecherche; /** Loading Loading @@ -270,27 +282,27 @@ class Structure implements HistoriqueAwareInterface, SourceAwareInterface } /** * @return Etablissement * @return Etablissement|null */ public function getEtablissement() { return $this->etablissement; return $this->etablissement->first(); } /** * @return EcoleDoctorale * @return EcoleDoctorale|null */ public function getEcoleDoctorale() { return $this->ecoleDoctorale; return $this->ecoleDoctorale->first(); } /** * @return UniteRecherche * @return UniteRecherche|null */ public function getUniteRecherche() { return $this->uniteRecherche; return $this->uniteRecherche->first(); } /** Loading module/Application/src/Application/Service/EcoleDoctorale/EcoleDoctoraleService.php +24 −20 Changes for module/Application/src/Application/Service/EcoleDoctorale/EcoleDoctoraleService.php: 24 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -4,16 +4,16 @@ namespace Application\Service\EcoleDoctorale; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Individu; use Application\Entity\Db\IndividuRole; use Application\Entity\Db\Repository\EcoleDoctoraleRepository; use Application\Entity\Db\Structure; use Application\Entity\Db\TypeStructure; use Application\Entity\Db\Utilisateur; use Application\Service\BaseService; use Application\Service\Role\RoleServiceAwareInterface; use Application\Service\Role\RoleServiceAwareTrait; use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\Query\Expr\Join; use UnicaenApp\Exception\RuntimeException; use UnicaenImport\Entity\Db\Source; /** * @method EcoleDoctorale|null findOneBy(array $criteria, array $orderBy = null) Loading @@ -21,6 +21,7 @@ use UnicaenApp\Exception\RuntimeException; class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInterface { use RoleServiceAwareTrait; /** * @return EcoleDoctoraleRepository */ Loading @@ -33,28 +34,25 @@ class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInter } /** * @param Source|null $source * @return EcoleDoctorale[] */ public function getEcolesDoctorales() { /** @var EcoleDoctorale[] $ecoles */ // $ecoles = $this->getRepository()->findAll(); // usort($ecoles, function ($a,$b) {return $a->getLibelle() > $b->getLibelle();}); // return $ecoles; $qb = $this->getEntityManager()->getRepository(EcoleDoctorale::class)->createQueryBuilder("ur") ->leftJoin("ur.structure", "str", "WITH", "ur.structure = str.id") public function getEcolesDoctorales(Source $source = null) { $qb = $this->getEntityManager()->getRepository(EcoleDoctorale::class)->createQueryBuilder("ed"); $qb ->leftJoin("ed.structure", "str", "WITH", "ed.structure = str.id") ->leftJoin("str.structuresSubstituees", "sub") ->leftJoin("str.typeStructure", "typ") ->addSelect("str, sub, typ") ->orderBy("str.libelle") ; ->orderBy("str.libelle"); if ($source !== null) { $qb ->join('ed.source', 'src', Join::WITH, 'src = :source') ->setParameter('source', $source); } // $ecoleDoctorale = $this->getEntityManager()->getRepository("TypeStructure")->findOneBy(["code" => TypeStructure::CODE_ECOLE_DOCTORALE]); // $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder("str") // ->leftJoin("str.ecoleDoctorale", "ed") // ->setParameter("ecoleDoctorale", $ecoleDoctorale) // ; $ecoles = $qb->getQuery()->getResult(); return $ecoles; Loading @@ -64,13 +62,16 @@ class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInter * @param int $id * @return null|EcoleDoctorale */ public function getEcoleDoctoraleById($id) { public function getEcoleDoctoraleById($id) { /** @var EcoleDoctorale $ecole */ $ecole = $this->getRepository()->findOneBy(["id" => $id]); return $ecole; } public function getEcoleDoctoraleByStructureId($id) { public function getEcoleDoctoraleByStructureId($id) { /** @var EcoleDoctorale $ecole */ $qb = $this->getRepository()->createQueryBuilder("ed") ->addSelect("s") Loading @@ -78,6 +79,7 @@ class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInter ->andWhere("s.id = :id") ->setParameter("id", $id); $ecole = $qb->getQuery()->getOneOrNullResult(); return $ecole; } Loading @@ -85,9 +87,11 @@ class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInter * @param int $id * @return Individu[] */ public function getIndividuByEcoleDoctoraleId($id) { public function getIndividuByEcoleDoctoraleId($id) { $ecole = $this->getEcoleDoctoraleById($id); $individus = $this->roleService->getIndividuByStructure($ecole->getStructure()); return $individus; } Loading module/Application/src/Application/Service/These/Factory/TheseRechercheServiceFactory.php +4 Changes for module/Application/src/Application/Service/These/Factory/TheseRechercheServiceFactory.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Application\Service\These\Factory; use Application\Service\EcoleDoctorale\EcoleDoctoraleService; use Application\Service\Etablissement\EtablissementService; use Application\Service\Source\SourceService; use Application\Service\These\TheseRechercheService; use Application\Service\These\TheseService; use Application\Service\UniteRecherche\UniteRechercheService; Loading @@ -26,12 +27,14 @@ class TheseRechercheServiceFactory * @var EtablissementService $etablissementService * @var UniteRechercheService $uniteService * @var EcoleDoctoraleService $ecoleDoctoraleService * @var SourceService $sourceService */ $theseService = $serviceLocator->get('TheseService'); $userContextService = $serviceLocator->get('UserContextService'); $ecoleDoctoraleService = $serviceLocator->get('EcoleDoctoraleService'); $uniteService = $serviceLocator->get('UniteRechercheService'); $etablissementService = $serviceLocator->get('EtablissementService'); $sourceService = $serviceLocator->get('SourceService'); $service = new TheseRechercheService(); $service->setTheseService($theseService); Loading @@ -39,6 +42,7 @@ class TheseRechercheServiceFactory $service->setEtablissementService($etablissementService); $service->setUniteRechercheService($uniteService); $service->setEcoleDoctoraleService($ecoleDoctoraleService); $service->setSourceService($sourceService); return $service; } Loading Loading
module/Application/src/Application/Controller/TheseController.php +1 −1 Changes for module/Application/src/Application/Controller/TheseController.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ class TheseController extends AbstractController } $this->theseRechercheService ->createFilters() ->createFiltersWithUnpopulatedOptions() ->createSorters() ->processQueryParams($queryParams); Loading
module/Application/src/Application/Entity/Db/Repository/TheseRepository.php +18 −2 Changes for module/Application/src/Application/Entity/Db/Repository/TheseRepository.php: 18 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -2,9 +2,11 @@ namespace Application\Entity\Db\Repository; use Application\Entity\Db\Etablissement; use Application\Entity\Db\These; use Application\ORM\Query\Functions\Year; use Application\QueryBuilder\TheseQueryBuilder; use Doctrine\ORM\Query\Expr\Join; /** * @method TheseQueryBuilder createQueryBuilder($alias, $indexBy = null) Loading Loading @@ -35,10 +37,11 @@ class TheseRepository extends DefaultEntityRepository } /** * @param Etablissement|null $etablissement * @return int[] * @see Year */ public function fetchDistinctAnneesPremiereInscription() public function fetchDistinctAnneesPremiereInscription(Etablissement $etablissement = null) { $qb = $this->createQueryBuilder('t'); $qb Loading @@ -46,6 +49,12 @@ class TheseRepository extends DefaultEntityRepository ->select("year(t.datePremiereInscription)") ->orderBy("year(t.datePremiereInscription)"); if ($etablissement !== null) { $qb ->join('t.etablissement', 'etab', Join::WITH, 'etab = :etablissement') ->setParameter('etablissement', $etablissement); } $results = array_map(function($value) { return current($value); }, $qb->getQuery()->getScalarResult()); Loading @@ -54,9 +63,10 @@ class TheseRepository extends DefaultEntityRepository } /** * @param Etablissement|null $etablissement * @return string[] */ public function fetchDistinctDisciplines() public function fetchDistinctDisciplines(Etablissement $etablissement = null) { $qb = $this->createQueryBuilder('t'); $qb Loading @@ -64,6 +74,12 @@ class TheseRepository extends DefaultEntityRepository ->select("t.libelleDiscipline") ->orderBy("t.libelleDiscipline"); if ($etablissement !== null) { $qb ->join('t.etablissement', 'etab', Join::WITH, 'etab = :etablissement') ->setParameter('etablissement', $etablissement); } $results = array_map(function($value) { return current($value); }, $qb->getQuery()->getScalarResult()); Loading
module/Application/src/Application/Entity/Db/Structure.php +18 −6 Changes for module/Application/src/Application/Entity/Db/Structure.php: 18 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Application\Entity\Db; use Doctrine\Common\Collections\Collection; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; use UnicaenApp\Exception\LogicException; Loading Loading @@ -45,8 +46,19 @@ class Structure implements HistoriqueAwareInterface, SourceAwareInterface */ protected $typeStructure; /** * @var Collection */ protected $etablissement; /** * @var Collection */ protected $ecoleDoctorale; /** * @var Collection */ protected $uniteRecherche; /** Loading Loading @@ -270,27 +282,27 @@ class Structure implements HistoriqueAwareInterface, SourceAwareInterface } /** * @return Etablissement * @return Etablissement|null */ public function getEtablissement() { return $this->etablissement; return $this->etablissement->first(); } /** * @return EcoleDoctorale * @return EcoleDoctorale|null */ public function getEcoleDoctorale() { return $this->ecoleDoctorale; return $this->ecoleDoctorale->first(); } /** * @return UniteRecherche * @return UniteRecherche|null */ public function getUniteRecherche() { return $this->uniteRecherche; return $this->uniteRecherche->first(); } /** Loading
module/Application/src/Application/Service/EcoleDoctorale/EcoleDoctoraleService.php +24 −20 Changes for module/Application/src/Application/Service/EcoleDoctorale/EcoleDoctoraleService.php: 24 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -4,16 +4,16 @@ namespace Application\Service\EcoleDoctorale; use Application\Entity\Db\EcoleDoctorale; use Application\Entity\Db\Individu; use Application\Entity\Db\IndividuRole; use Application\Entity\Db\Repository\EcoleDoctoraleRepository; use Application\Entity\Db\Structure; use Application\Entity\Db\TypeStructure; use Application\Entity\Db\Utilisateur; use Application\Service\BaseService; use Application\Service\Role\RoleServiceAwareInterface; use Application\Service\Role\RoleServiceAwareTrait; use Doctrine\ORM\OptimisticLockException; use Doctrine\ORM\Query\Expr\Join; use UnicaenApp\Exception\RuntimeException; use UnicaenImport\Entity\Db\Source; /** * @method EcoleDoctorale|null findOneBy(array $criteria, array $orderBy = null) Loading @@ -21,6 +21,7 @@ use UnicaenApp\Exception\RuntimeException; class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInterface { use RoleServiceAwareTrait; /** * @return EcoleDoctoraleRepository */ Loading @@ -33,28 +34,25 @@ class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInter } /** * @param Source|null $source * @return EcoleDoctorale[] */ public function getEcolesDoctorales() { /** @var EcoleDoctorale[] $ecoles */ // $ecoles = $this->getRepository()->findAll(); // usort($ecoles, function ($a,$b) {return $a->getLibelle() > $b->getLibelle();}); // return $ecoles; $qb = $this->getEntityManager()->getRepository(EcoleDoctorale::class)->createQueryBuilder("ur") ->leftJoin("ur.structure", "str", "WITH", "ur.structure = str.id") public function getEcolesDoctorales(Source $source = null) { $qb = $this->getEntityManager()->getRepository(EcoleDoctorale::class)->createQueryBuilder("ed"); $qb ->leftJoin("ed.structure", "str", "WITH", "ed.structure = str.id") ->leftJoin("str.structuresSubstituees", "sub") ->leftJoin("str.typeStructure", "typ") ->addSelect("str, sub, typ") ->orderBy("str.libelle") ; ->orderBy("str.libelle"); if ($source !== null) { $qb ->join('ed.source', 'src', Join::WITH, 'src = :source') ->setParameter('source', $source); } // $ecoleDoctorale = $this->getEntityManager()->getRepository("TypeStructure")->findOneBy(["code" => TypeStructure::CODE_ECOLE_DOCTORALE]); // $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder("str") // ->leftJoin("str.ecoleDoctorale", "ed") // ->setParameter("ecoleDoctorale", $ecoleDoctorale) // ; $ecoles = $qb->getQuery()->getResult(); return $ecoles; Loading @@ -64,13 +62,16 @@ class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInter * @param int $id * @return null|EcoleDoctorale */ public function getEcoleDoctoraleById($id) { public function getEcoleDoctoraleById($id) { /** @var EcoleDoctorale $ecole */ $ecole = $this->getRepository()->findOneBy(["id" => $id]); return $ecole; } public function getEcoleDoctoraleByStructureId($id) { public function getEcoleDoctoraleByStructureId($id) { /** @var EcoleDoctorale $ecole */ $qb = $this->getRepository()->createQueryBuilder("ed") ->addSelect("s") Loading @@ -78,6 +79,7 @@ class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInter ->andWhere("s.id = :id") ->setParameter("id", $id); $ecole = $qb->getQuery()->getOneOrNullResult(); return $ecole; } Loading @@ -85,9 +87,11 @@ class EcoleDoctoraleService extends BaseService implements RoleServiceAwareInter * @param int $id * @return Individu[] */ public function getIndividuByEcoleDoctoraleId($id) { public function getIndividuByEcoleDoctoraleId($id) { $ecole = $this->getEcoleDoctoraleById($id); $individus = $this->roleService->getIndividuByStructure($ecole->getStructure()); return $individus; } Loading
module/Application/src/Application/Service/These/Factory/TheseRechercheServiceFactory.php +4 Changes for module/Application/src/Application/Service/These/Factory/TheseRechercheServiceFactory.php: 4 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Application\Service\These\Factory; use Application\Service\EcoleDoctorale\EcoleDoctoraleService; use Application\Service\Etablissement\EtablissementService; use Application\Service\Source\SourceService; use Application\Service\These\TheseRechercheService; use Application\Service\These\TheseService; use Application\Service\UniteRecherche\UniteRechercheService; Loading @@ -26,12 +27,14 @@ class TheseRechercheServiceFactory * @var EtablissementService $etablissementService * @var UniteRechercheService $uniteService * @var EcoleDoctoraleService $ecoleDoctoraleService * @var SourceService $sourceService */ $theseService = $serviceLocator->get('TheseService'); $userContextService = $serviceLocator->get('UserContextService'); $ecoleDoctoraleService = $serviceLocator->get('EcoleDoctoraleService'); $uniteService = $serviceLocator->get('UniteRechercheService'); $etablissementService = $serviceLocator->get('EtablissementService'); $sourceService = $serviceLocator->get('SourceService'); $service = new TheseRechercheService(); $service->setTheseService($theseService); Loading @@ -39,6 +42,7 @@ class TheseRechercheServiceFactory $service->setEtablissementService($etablissementService); $service->setUniteRechercheService($uniteService); $service->setEcoleDoctoraleService($ecoleDoctoraleService); $service->setSourceService($sourceService); return $service; } Loading