Commit 8dafcffd authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Classement des substitutions par ordre alphabetique

parent 1bf1a069
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for module/Application/src/Application/Controller/SubstitutionController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ class SubstitutionController extends AbstractController
    /** Affiche l'index d'un type de structure donnée */
    public function indexStructureAction() {
        $type = $this->params()->fromRoute("type");
        $structures = $this->getStructureService()->getStructuresSubstituantes($type);
        $structures = $this->getStructureService()->getStructuresSubstituantes($type, 'libelle');

        return new ViewModel([
            'type' => $type,
+3 −1
Changes for module/Application/src/Application/Service/Structure/StructureService.php: 3 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ class StructureService extends BaseService
     * Cette fonction retourne la liste des structures qui substitue d'autres structures
     * @return Structure[]
     */
    public function getStructuresSubstituantes($type = null)
    public function getStructuresSubstituantes($type = null, $order = null)
    {
        $qb = $this->getEntityManager()->getRepository(Structure::class)->createQueryBuilder("s")
            ->andWhere("s.structuresSubstituees IS NOT EMPTY");
@@ -340,6 +340,8 @@ class StructureService extends BaseService
            $qb->andWhere("s.typeStructure = :type")
                ->setParameter("type", $typeStructure);
        }
        if ($order)
            $qb->orderBy('s.'.$order);

        $results = $qb->getQuery()->getResult();
        return $results;