Loading src/Octopus/Entity/Db/Individu.php +6 −1 Original line number Diff line number Diff line Loading @@ -223,7 +223,12 @@ class Individu { public function __toString() { $texte = $this->getPrenom(). " " . $this->getNomUsage(); $texte = $this->getPrenom(); if ($this->getNomUsage()) $texte .= " " . $this->getNomUsage(); if ($this->getNomUsage() != $this->getNomFamille()) { if ($this->getNomUsage()) $texte .= "-"; else $texte .= " "; $texte .= $this->getNomFamille(); } return $texte; } Loading src/Octopus/Entity/Db/StructureType.php +11 −11 Original line number Diff line number Diff line Loading @@ -4,17 +4,17 @@ namespace Octopus\Entity\Db; class StructureType { const TYPE_ANTN = 'Antenne'; const TYPE_BIBL = 'Bibliothèque'; const TYPE_COMP = 'Composante'; const TYPE_DEPT = 'Département'; const TYPE_ED = 'École doctorale'; const TYPE_ETAB = 'Établissement'; const TYPE_FICT = 'Structure fictive'; const TYPE_SCEN = 'Service central'; const TYPE_SCOM = 'Service commun'; const TYPE_SREC = 'Structure de recherche'; const TYPE_SSAD = 'Sous-structure administrative'; const TYPE_ANTN = 'ANTN'; const TYPE_BIBL = 'BIBL'; const TYPE_COMP = 'COMP'; const TYPE_DEPT = 'DEPT'; const TYPE_ED = 'ED'; const TYPE_ETAB = 'ETAB'; const TYPE_FICT = 'FICT'; const TYPE_SCEN = 'SCEN'; const TYPE_SCOM = 'SCOM'; const TYPE_SREC = 'SREC'; const TYPE_SSAD = 'SSAD'; /** @var integer */ private $id; Loading src/Octopus/Service/Individu/IndividuService.php +25 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ class IndividuService { { $qb = $this->getEntityManager()->getRepository(Individu::class)->createQueryBuilder('individu') ->addSelect('source')->join('individu.cSource', 'source') ->andWhere('individu.nomUsage LIKE :search') ->andWhere('individu.nomUsage LIKE :search OR individu.nomFamille LIKE :search') ->setParameter('search', '%'.$term.'%') ->orderBy('individu.nomUsage, individu.prenom') ; Loading @@ -70,6 +70,30 @@ class IndividuService { return $result; } /** * @param string $term * @return Individu[] */ public function getEtudiantsByTerm($term, $sourceCode = null) { $qb = $this->getEntityManager()->getRepository(Individu::class)->createQueryBuilder('individu') ->join('individu.affectations', 'affectation') ->andWhere('LOWER(CONCAT(individu.nomUsage, \' \' , individu.prenom, \' \', individu.nomUsage, \' \')) OR LOWER(CONCAT(individu.nomFamille, \' \' , individu.prenom, \' \', individu.nomFamille, \' \')) OR individu.cEtu LIKE :term ') ->andWhere('affectation.type = :type') ->setParameter('search', '%'.strtolower($term).'%') ->setParameter('term', $term.'%') ->setParameter('type', 5) ->orderBy('individu.nomUsage, individu.prenom') ; $result = $qb->getQuery()->getResult(); return $result; } /** * @param integer $numeroEtudiant * @return Individu Loading src/Octopus/Service/Structure/StructureService.php +25 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,25 @@ class StructureService { return $result; } /** * @param string $code * @return StructureType */ public function getStructureTypeByCode($code) { $qb = $this->getEntityManager()->getRepository(StructureType::class)->createQueryBuilder('type') ->andWhere('type.code :code') ->setParameter('code', $code) ; try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs StructureType partagent le même code [".$code."]."); } return $result; } /** * @param string $term * @return StructureType[] Loading Loading @@ -130,10 +149,14 @@ class StructureService { */ public function getStructuresByType($type, $order = null) { $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder('type') /** @var StructureType $structureType */ $structureType = $this->getStructureTypeByCode($type); var_dump($structureType); $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder('structure') ->addSelect('type')->join('structure.type', 'type') ->andWhere('type.code = :type') ->setParameter('type', $type) ->setParameter('type', $structureType->getId()) ; if ($order) $qb = $qb->orderBy('type.'.$order); Loading Loading
src/Octopus/Entity/Db/Individu.php +6 −1 Original line number Diff line number Diff line Loading @@ -223,7 +223,12 @@ class Individu { public function __toString() { $texte = $this->getPrenom(). " " . $this->getNomUsage(); $texte = $this->getPrenom(); if ($this->getNomUsage()) $texte .= " " . $this->getNomUsage(); if ($this->getNomUsage() != $this->getNomFamille()) { if ($this->getNomUsage()) $texte .= "-"; else $texte .= " "; $texte .= $this->getNomFamille(); } return $texte; } Loading
src/Octopus/Entity/Db/StructureType.php +11 −11 Original line number Diff line number Diff line Loading @@ -4,17 +4,17 @@ namespace Octopus\Entity\Db; class StructureType { const TYPE_ANTN = 'Antenne'; const TYPE_BIBL = 'Bibliothèque'; const TYPE_COMP = 'Composante'; const TYPE_DEPT = 'Département'; const TYPE_ED = 'École doctorale'; const TYPE_ETAB = 'Établissement'; const TYPE_FICT = 'Structure fictive'; const TYPE_SCEN = 'Service central'; const TYPE_SCOM = 'Service commun'; const TYPE_SREC = 'Structure de recherche'; const TYPE_SSAD = 'Sous-structure administrative'; const TYPE_ANTN = 'ANTN'; const TYPE_BIBL = 'BIBL'; const TYPE_COMP = 'COMP'; const TYPE_DEPT = 'DEPT'; const TYPE_ED = 'ED'; const TYPE_ETAB = 'ETAB'; const TYPE_FICT = 'FICT'; const TYPE_SCEN = 'SCEN'; const TYPE_SCOM = 'SCOM'; const TYPE_SREC = 'SREC'; const TYPE_SSAD = 'SSAD'; /** @var integer */ private $id; Loading
src/Octopus/Service/Individu/IndividuService.php +25 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ class IndividuService { { $qb = $this->getEntityManager()->getRepository(Individu::class)->createQueryBuilder('individu') ->addSelect('source')->join('individu.cSource', 'source') ->andWhere('individu.nomUsage LIKE :search') ->andWhere('individu.nomUsage LIKE :search OR individu.nomFamille LIKE :search') ->setParameter('search', '%'.$term.'%') ->orderBy('individu.nomUsage, individu.prenom') ; Loading @@ -70,6 +70,30 @@ class IndividuService { return $result; } /** * @param string $term * @return Individu[] */ public function getEtudiantsByTerm($term, $sourceCode = null) { $qb = $this->getEntityManager()->getRepository(Individu::class)->createQueryBuilder('individu') ->join('individu.affectations', 'affectation') ->andWhere('LOWER(CONCAT(individu.nomUsage, \' \' , individu.prenom, \' \', individu.nomUsage, \' \')) OR LOWER(CONCAT(individu.nomFamille, \' \' , individu.prenom, \' \', individu.nomFamille, \' \')) OR individu.cEtu LIKE :term ') ->andWhere('affectation.type = :type') ->setParameter('search', '%'.strtolower($term).'%') ->setParameter('term', $term.'%') ->setParameter('type', 5) ->orderBy('individu.nomUsage, individu.prenom') ; $result = $qb->getQuery()->getResult(); return $result; } /** * @param integer $numeroEtudiant * @return Individu Loading
src/Octopus/Service/Structure/StructureService.php +25 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,25 @@ class StructureService { return $result; } /** * @param string $code * @return StructureType */ public function getStructureTypeByCode($code) { $qb = $this->getEntityManager()->getRepository(StructureType::class)->createQueryBuilder('type') ->andWhere('type.code :code') ->setParameter('code', $code) ; try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $e) { throw new RuntimeException("Plusieurs StructureType partagent le même code [".$code."]."); } return $result; } /** * @param string $term * @return StructureType[] Loading Loading @@ -130,10 +149,14 @@ class StructureService { */ public function getStructuresByType($type, $order = null) { $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder('type') /** @var StructureType $structureType */ $structureType = $this->getStructureTypeByCode($type); var_dump($structureType); $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder('structure') ->addSelect('type')->join('structure.type', 'type') ->andWhere('type.code = :type') ->setParameter('type', $type) ->setParameter('type', $structureType->getId()) ; if ($order) $qb = $qb->orderBy('type.'.$order); Loading