DDC-3207: Paginator does not count according to query max results #3970

Open
opened 2026-01-22 14:32:34 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Jul 5, 2014).

Originally assigned to: @Ocramius on GitHub.

Jira issue originally created by user draeli:

I use Doctrine\ORM\Tools\Pagination\Paginator to have an paginate object and use like this :

$paginator = new Paginator($query);
$paginator->getQuery()->setFirstResult(0)->setMaxResults(1);

In this case when I do a count on object result and have "int 2" in spite I expected "int 1".

I look the class and find may be the problem, why there is this ?

$countQuery->setFirstResult(null)->setMaxResults(null);

in "count" method.

If I remove this line, expected result appear.

Originally created by @doctrinebot on GitHub (Jul 5, 2014). Originally assigned to: @Ocramius on GitHub. Jira issue originally created by user draeli: I use `Doctrine\ORM\Tools\Pagination\Paginator` to have an paginate object and use like this : ``` $paginator = new Paginator($query); $paginator->getQuery()->setFirstResult(0)->setMaxResults(1); ``` In this case when I do a count on object result and have "int 2" in spite I expected "int 1". I look the class and find may be the problem, why there is this ? ``` $countQuery->setFirstResult(null)->setMaxResults(null); ``` in "count" method. If I remove this line, expected result appear.
admin added the Bug label 2026-01-22 14:32:34 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3970