Skip to content

Commit

Permalink
Use addSelect to allow other columns to be selected
Browse files Browse the repository at this point in the history
  • Loading branch information
juniwalk authored Feb 19, 2024
1 parent cca7f4e commit c36e0ae
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public function __construct(EntityManager $entityManager)
}



/**
* @throws NoResultException
*/
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit c36e0ae

Please sign in to comment.