fix configuration for EventSearch

This commit is contained in:
Julien Fastré 2023-07-20 15:50:05 +02:00
parent aa553db659
commit d048ee3b44
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -43,10 +43,10 @@ class EventSearch extends AbstractSearch
public function __construct( public function __construct(
private readonly Security $security, private readonly Security $security,
private readonly EventRepository $er, private readonly EventRepository $eventRepository,
private readonly AuthorizationHelper $authorizationHelper, private readonly AuthorizationHelper $authorizationHelper,
private readonly \Twig\Environment $templating, private readonly \Twig\Environment $templating,
private readonly PaginatorFactory $paginationFactory private readonly PaginatorFactory $paginatorFactory
) { ) {
} }
@ -68,7 +68,7 @@ class EventSearch extends AbstractSearch
$format = 'html' $format = 'html'
) { ) {
$total = $this->count($terms); $total = $this->count($terms);
$paginator = $this->paginationFactory->create($total); $paginator = $this->paginatorFactory->create($total);
if ('html' === $format) { if ('html' === $format) {
return $this->templating->render( return $this->templating->render(
@ -184,7 +184,7 @@ class EventSearch extends AbstractSearch
protected function count(array $terms) protected function count(array $terms)
{ {
$qb = $this->er->createQueryBuilder('e'); $qb = $this->eventRepository->createQueryBuilder('e');
$qb->select('COUNT(e)'); $qb->select('COUNT(e)');
$this->composeQuery($qb, $terms); $this->composeQuery($qb, $terms);
@ -198,7 +198,7 @@ class EventSearch extends AbstractSearch
protected function search(array $terms, $start, $limit, $options) protected function search(array $terms, $start, $limit, $options)
{ {
$qb = $this->er->createQueryBuilder('e'); $qb = $this->eventRepository->createQueryBuilder('e');
$qb->select('e'); $qb->select('e');
$this->composeQuery($qb, $terms) $this->composeQuery($qb, $terms)
->setMaxResults($limit) ->setMaxResults($limit)