mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +00:00
39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Chill is a software for social workers
|
|
*
|
|
* For the full copyright and license information, please view
|
|
* the LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Chill\MainBundle\Controller;
|
|
|
|
use Chill\MainBundle\CRUD\Controller\ApiController;
|
|
use Chill\MainBundle\Pagination\PaginatorInterface;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
|
|
/**
|
|
* Class AddressReferenceAPIController.
|
|
*/
|
|
class AddressReferenceAPIController extends ApiController
|
|
{
|
|
protected function customizeQuery(string $action, Request $request, $qb): void
|
|
{
|
|
if ($request->query->has('postal_code')) {
|
|
$qb->where('e.postcode = :postal_code')
|
|
->setParameter('postal_code', $request->query->get('postal_code'));
|
|
}
|
|
}
|
|
|
|
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
|
|
{
|
|
$query->addOrderBy('e.street', 'ASC');
|
|
$query->addOrderBy('e.streetNumber', 'ASC');
|
|
|
|
return $query;
|
|
}
|
|
}
|