Merge branch 'master' into bootstrap5

This commit is contained in:
2021-08-05 15:13:55 +02:00
3 changed files with 75 additions and 3 deletions

View File

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