From c36e0ae418d3c0f212922137e6f9193ec6a61ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Proch=C3=A1zka?= Date: Mon, 19 Feb 2024 13:06:04 +0100 Subject: [PATCH] Use addSelect to allow other columns to be selected --- src/AbstractRepository.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/AbstractRepository.php b/src/AbstractRepository.php index 24e4f24..4222350 100644 --- a/src/AbstractRepository.php +++ b/src/AbstractRepository.php @@ -44,7 +44,6 @@ public function __construct(EntityManager $entityManager) } - /** * @throws NoResultException */ @@ -150,7 +149,7 @@ public function countBy( ?int $maxResults = null, ?string $indexBy = self::DefaultIndexBy, ): int|float|array { - $where = fn($qb) => ($where($qb) ?? $qb)->select('COUNT('.self::DefaultIdentifier.')'); + $where = fn($qb) => ($where($qb) ?? $qb)->addSelect('COUNT('.self::DefaultIdentifier.')'); $qb = $this->createQueryBuilder(self::DefaultAlias, $indexBy, $where); $qb->setMaxResults($qb->getMaxResults() ?? $maxResults);