mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2954: Paginator loses items #3677
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Feb 5, 2014).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user mariusz.jaskolka:
Sometimes when when I use Paginator (Doctrine\ORM\Tools\Pagination\Paginator)
there are too few items in result (no, it is not the end of list). There two situations:
EDIT:
In function Paginator::getIterator there is variable $ids. In my situation it contains five numbers [34,26,34,15,12]. There is duplicated value 34 but ids of top-level entities should be distinct (as far as we do not use CROSS JOIN, or maybe I am wrong).
The Paginator::count function works correctly, it does not count duplicated values twice.
Statement that gets $ids is like following:
SELECT a.* FROM (SELECT DISTINCT ID2, BEGINTIME70 FROM (...) dctrn_result ORDER BY BEGINTIME70 DESC) a WHERE ROWNUM <= 5
EDIT 2 - Bugfix description:
The result items of the query is not unique because of
"SELECT DISTINCT col_with_id, order_by_column (...) ORDER BY order_by_column".
If we had items like following:
(1,A)
(1,B)
(1,B)
(2,C)
After DISTINCT operation the result would be:
(1,A)
(1,B)
(2,C)
But we want to have unique firs column, not pairs. That's why we should do "ORDER BY" before "DISTINCT" - not in the same time.
Please confirm if the solution is correct.
@doctrinebot commented on GitHub (Feb 5, 2014):
Comment created by @ocramius:
[~mariusz.jaskolka] this needs more details
@doctrinebot commented on GitHub (Feb 6, 2014):
Comment created by mariusz.jaskolka:
OK, I will try to find out where the problem is.
@doctrinebot commented on GitHub (Feb 6, 2014):
Comment created by mariusz.jaskolka:
I have edited description, maybe additional information will help.
@doctrinebot commented on GitHub (Feb 7, 2014):
Comment created by mariusz.jaskolka:
I send the bugfix in attachment. I will describe it soon.
@doctrinebot commented on GitHub (Feb 7, 2014):
Comment created by mariusz.jaskolka:
Bugfix version 2 - previously I did not notice that oracle loses order after DISTINCT operation. Thus I used GROUP BY.
@doctrinebot commented on GitHub (Feb 11, 2014):
Comment created by mariusz.jaskolka:
I do not know if I can change status of this issue from "Awaiting Feedback". I can not see such option :D