Commit 632acc87 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Correction de bug dans la recherche de structure

parent 0d67c435
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ class StructureService {
    public function getStructureTypeByCode($code)
    {
        $qb = $this->getEntityManager()->getRepository(StructureType::class)->createQueryBuilder('type')
            ->andWhere('type.code  :code')
            ->andWhere('type.code = :code')
            ->setParameter('code', $code)
        ;

@@ -151,17 +151,16 @@ class StructureService {
    {
        /** @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', $structureType->getId())
            ->setParameter('type', $type)
        ;

        if ($order) $qb = $qb->orderBy('type.'.$order);
        if ($order) $qb = $qb->orderBy('structure.'.$order);

        $qb = $qb->setMaxResults(501);
        //$qb = $qb->setMaxResults(501);

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