Closed Brewal closed 11 months ago
In some cases (no paginator and queries with joins, etc.), the count method of the DoctrineRepository seems to return wrong results :
count
DoctrineRepository
https://github.com/mtarld/apip-ddd/blob/a7608c6e1249d53821c30a434f8c15534e6a229c/src/Shared/Infrastructure/Doctrine/DoctrineRepository.php#L49-L56
I had better results relying on the doctrine paginator's logic :
if (null !== $paginator = $this->paginator()) { return count($paginator); } return (new Paginator(clone $this->queryBuilder))->count();
This is a nice catch! Thanks, @Brewal, I've created a PR to apply your fix.
In some cases (no paginator and queries with joins, etc.), the
count
method of theDoctrineRepository
seems to return wrong results :https://github.com/mtarld/apip-ddd/blob/a7608c6e1249d53821c30a434f8c15534e6a229c/src/Shared/Infrastructure/Doctrine/DoctrineRepository.php#L49-L56
I had better results relying on the doctrine paginator's logic :