Details

    • Type: Bug Bug
    • Status: Awaiting Feedback
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.4, 2.4.1
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Environment:
      Linux and Windows, PHP 5, Oracle(OCI8)

      Description

      Sometimes when when I use Paginator (Doctrine\ORM\Tools\Pagination\Paginator)

      • with query contains orderBy
      • with $fetchJoinCollection = true
      • lot of joins with toMany associations

      there are too few items in result (no, it is not the end of list). There two situations:
      1. I have four items on page 1 and two items on page 2 (pageLimit is 5). It is no so bad
      2. I have four items on page 1 and there is no page 2 (while there should be 5 all items). This is very bad because I lose one item.

      ------------------------------------------------------------------
      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.

      1. LimitSubqueryOutputWalker_bugfix.php
        9 kB
        Mariusz Jaskółka
      2. LimitSubqueryOutputWalker.php
        8 kB
        Mariusz Jaskółka

        Activity

        Hide
        Marco Pivetta added a comment -

        Mariusz Jaskółka this needs more details

        Show
        Marco Pivetta added a comment - Mariusz Jaskółka this needs more details
        Hide
        Mariusz Jaskółka added a comment -

        OK, I will try to find out where the problem is.

        Show
        Mariusz Jaskółka added a comment - OK, I will try to find out where the problem is.
        Hide
        Mariusz Jaskółka added a comment -

        I have edited description, maybe additional information will help.

        Show
        Mariusz Jaskółka added a comment - I have edited description, maybe additional information will help.
        Hide
        Mariusz Jaskółka added a comment -

        I send the bugfix in attachment. I will describe it soon.

        Show
        Mariusz Jaskółka added a comment - I send the bugfix in attachment. I will describe it soon.
        Hide
        Mariusz Jaskółka added a comment - - edited

        Bugfix version 2 - previously I did not notice that oracle loses order after DISTINCT operation. Thus I used GROUP BY.

        Show
        Mariusz Jaskółka added a comment - - edited Bugfix version 2 - previously I did not notice that oracle loses order after DISTINCT operation. Thus I used GROUP BY.
        Hide
        Mariusz Jaskółka added a comment -

        I do not know if I can change status of this issue from "Awaiting Feedback". I can not see such option

        Show
        Mariusz Jaskółka added a comment - I do not know if I can change status of this issue from "Awaiting Feedback". I can not see such option

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Mariusz Jaskółka
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: