add order in localisation entity list (api)

This commit is contained in:
Julien Fastré 2022-02-09 23:43:52 +01:00
parent 4e862cc585
commit 406cfc86cd
2 changed files with 14 additions and 1 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to
<!-- write down unreleased development here -->
* 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

View File

@ -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');
}
}