Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1806

DQL with and without fetch join cause

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2, 2.2.1, 2.2.2, Git Master
    • Fix Version/s: None
    • Component/s: DQL, ORM
    • Security Level: All
    • Labels:
      None

      Description

      When running following DQL in newly cleared EntityManager, with the provided entities (see attached archive or gist at https://gist.github.com/2473775 ), results in different fetched association:

      DQL without join:
      SELECT a FROM Entity\A a WHERE a.id = :id

      SQL without join:
      SELECT a0_.a_id AS a_id0, a0_.id AS id1 FROM a a0_ WHERE a0_.a_id = ?

      Result without join:
      $query->getOneOrNullResult()>getB()>getName(); // 'correct'

      DQL with fetch join:
      SELECT a, b FROM Entity\A a LEFT JOIN a.b b WHERE a.id = :id

      SQL with fetch join:
      SELECT a0_.a_id AS a_id0, b1_.id AS id1, b1_.name AS name2, a0_.id AS id3 FROM a a0_ LEFT JOIN b b1_ ON a0_.id = b1_.id WHERE a0_.a_id = ?

      Result with fetch join:
      $query->getOneOrNullResult()>getB()>getName(); // 'wrong' (different result)

      The problem seems to be strictly related with how the `@JoinColumn` is configured.

        Activity

        Marco Pivetta created issue -
        Hide
        Marco Pivetta added a comment -
        Show
        Marco Pivetta added a comment - Attaching failing test from https://github.com/Ocramius/doctrine2/compare/DDC-1806
        Marco Pivetta made changes -
        Field Original Value New Value
        Attachment DDC1806Test.php [ 11188 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 13675 ] jira-feedback [ 14058 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 14058 ] jira-feedback2 [ 15922 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15922 ] jira-feedback3 [ 18174 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-1806, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Marco Pivetta
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: