diff --git a/src/Shared/Infrastructure/Doctrine/DoctrineRepository.php b/src/Shared/Infrastructure/Doctrine/DoctrineRepository.php index eda69f0..dd84c0e 100644 --- a/src/Shared/Infrastructure/Doctrine/DoctrineRepository.php +++ b/src/Shared/Infrastructure/Doctrine/DoctrineRepository.php @@ -46,14 +46,9 @@ public function getIterator(): \Iterator public function count(): int { - if (null !== $paginator = $this->paginator()) { - return count($paginator); - } + $paginator = $this->paginator() ?? new Paginator(clone $this->queryBuilder); - return (int) (clone $this->queryBuilder) - ->select('count(1)') - ->getQuery() - ->getSingleScalarResult(); + return count($paginator); } public function paginator(): ?PaginatorInterface