Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2953

ArrayHydrator: Not all items hydrated while orderBy

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.3.4, 2.4.1
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
    • Environment:
      Linux and Windows, PHP5

      Description

      I will explain the problem using example and pseudo-code:

      I have query like that:
      SELECT (...) FROM order LEFT JOIN person LEFT JOIN identifier (...) order by (...)

      The rows returned by query are following (the order is very important):
      order_id|person_id|identifier_id|
      12 |21 |33 |
      12 |21 |34 |
      11 |21 |35 |
      11 |21 |33 |
      11 |21 |34 |
      12 |21 |35 |

      After hydration the result is like:
      result[0][person][identifier][0][id]=33
      result[0][person][identifier][0][id]=34
      result[1][person][identifier][0][id]=35
      result[1][person][identifier][0][id]=34

      But it should be:
      result[0][person][identifier][0][id]=33
      result[0][person][identifier][0][id]=34
      result[0][person][identifier][0][id]=35
      result[1][person][identifier][0][id]=35
      result[1][person][identifier][0][id]=34
      result[1][person][identifier][0][id]=33

      The reason is that ArrayHydrator::_identifierMap contains only object id and parents object id. In may example there is difference in parents parent (grandparent) id.

      1. Array_hydrator_4.2_bugfix.php
        12 kB
        Mariusz Jaskółka
      2. Array_Hydrator_4.2.php
        11 kB
        Mariusz Jaskółka
      3. ArrayHydrator.php
        12 kB
        Mariusz Jaskółka

        Issue Links

          Activity

          Mariusz Jaskółka created issue -
          Marco Pivetta made changes -
          Field Original Value New Value
          Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
          Marco Pivetta made changes -
          Priority Major [ 3 ] Critical [ 2 ]
          Mariusz Jaskółka made changes -
          Attachment ArrayHydrator.php [ 11715 ]
          Mariusz Jaskółka made changes -
          Attachment Array_Hydrator_4.2.php [ 11716 ]
          Attachment Array_hydrator_4.2_bugfix.php [ 11717 ]
          Marco Pivetta made changes -
          Assignee Marco Pivetta [ ocramius ] Guilherme Blanco [ guilhermeblanco ]
          Marco Pivetta made changes -
          Link This issue depends on DDC-2955 [ DDC-2955 ]

            People

            • Assignee:
              Guilherme Blanco
              Reporter:
              Mariusz Jaskółka
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: