From 368846e09bf586c77fb2dbe2049b0ec0d26f87bd Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 8 Dec 2022 10:39:58 +0100 Subject: [PATCH] FIXED: [api] sort users list by label https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/681 --- .../ChillMainBundle/Controller/UserApiController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Bundle/ChillMainBundle/Controller/UserApiController.php b/src/Bundle/ChillMainBundle/Controller/UserApiController.php index b29fe7c8e..1e103a934 100644 --- a/src/Bundle/ChillMainBundle/Controller/UserApiController.php +++ b/src/Bundle/ChillMainBundle/Controller/UserApiController.php @@ -12,6 +12,7 @@ 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\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -70,4 +71,14 @@ class UserApiController extends ApiController $query->andWhere($query->expr()->eq('e.enabled', "'TRUE'")); } } + + /** + * @param mixed $query + * @param mixed $_format + */ + protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format) + { + return $query->orderBy('e.label', 'ASC'); + } + }