mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
Merge branch 'master' into add-location-period
This commit is contained in:
@@ -3,8 +3,12 @@
|
||||
namespace Chill\PersonBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\ApiController;
|
||||
use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator;
|
||||
use Chill\MainBundle\Pagination\PaginatorInterface;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\Query;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class SocialIssueApiController extends ApiController
|
||||
{
|
||||
@@ -16,6 +20,25 @@ class SocialIssueApiController extends ApiController
|
||||
$query->expr()->isNull('e.desactivationDate')
|
||||
)
|
||||
);
|
||||
$query->setParameter('now', new \DateTimeImmutable());
|
||||
$query->setParameter('now', new DateTimeImmutable());
|
||||
}
|
||||
|
||||
protected function getQueryResult(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query)
|
||||
{
|
||||
// In order to work, this hydrator only works with
|
||||
// entities having the field "children" set up.
|
||||
return $query
|
||||
->getQuery()
|
||||
->setHint(Query::HINT_INCLUDE_META_COLUMNS, true)
|
||||
->getResult(FlatHierarchyEntityHydrator::LIST);
|
||||
}
|
||||
|
||||
protected function onPostIndexBuildQuery(string $action, Request $request, string $_format, int $totalItems, PaginatorInterface $paginator, $query): ?Response
|
||||
{
|
||||
$query
|
||||
->orderBy("GET_JSON_FIELD_BY_KEY(e.title, :locale)", 'ASC')
|
||||
->setParameter(':locale', $request->getLocale());
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user