Prevent multiples sub-queries.

This commit is contained in:
Pol Dellaiera
2021-06-30 22:44:43 +02:00
parent e1f8aa5a5e
commit ef6c5870b5
2 changed files with 12 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ 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;
@@ -26,7 +27,10 @@ class SocialIssueApiController extends ApiController
{
// In order to work, this hydrator only works with
// entities having the field "children" set up.
return $query->getQuery()->getResult(FlatHierarchyEntityHydrator::LIST);
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