diff --git a/CHANGELOG.md b/CHANGELOG.md index 570bb2c0a..ce8375164 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to * change order for accompanying course work list * [person]: style fix in parcours listing per person. (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/432) +* ajoute un ordre dans les localisation (api) ## Test releases diff --git a/src/Bundle/ChillMainBundle/Controller/LocationApiController.php b/src/Bundle/ChillMainBundle/Controller/LocationApiController.php index 250d92980..237e91792 100644 --- a/src/Bundle/ChillMainBundle/Controller/LocationApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/LocationApiController.php @@ -12,6 +12,8 @@ declare(strict_types=1); namespace Chill\MainBundle\Controller; use Chill\MainBundle\CRUD\Controller\ApiController; +use Chill\MainBundle\Pagination\PaginatorInterface; +use Doctrine\ORM\QueryBuilder; use Symfony\Component\HttpFoundation\Request; /** @@ -19,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request; */ class LocationApiController extends ApiController { - public function customizeQuery(string $action, Request $request, $query): void + protected function customizeQuery(string $action, Request $request, $query): void { $query ->leftJoin('e.locationType', 'lt') @@ -31,4 +33,14 @@ class LocationApiController extends ApiController ) ); } + + /** + * @param QueryBuilder $query + */ + protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) + { + return $query + ->addOrderBy('e.name', 'ASC'); + } + }