Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-1314

DQL permits partial select using SQL

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.1
    • Fix Version/s: 3.0
    • Component/s: DQL
    • Security Level: All
    • Labels:
      None
    • Environment:
      Mac OS X 10.6.7, PHP 5.3.5, Doctrine 2.1.0

      Description

      The following code is not correct DQL and should (I think?) throw an error:

      $query = $em->createQuery("SELECT g.id, g.name FROM Entity\Group g ORDER BY g.name ASC");

      ...to force the user to use SELECT partial g.

      {id,name}

      ...

      Instead, it causes very funny behaviour. eg. when iterating, objects are passed to the foreach in the following pattern:

      $groups = $query->iterate();
      foreach(...) {
      1st time: $groups = array( [0] => object )
      2nd time: $groups = array( [1] => object )
      3rd time: $groups = array( [2] => object )
      }

        Issue Links

          Activity

          daniel.beresh Daniel Beresh created issue -
          Hide
          beberlei Benjamin Eberlei added a comment -

          The incrementation of the return value is a bug, but SELECT g.id, g.name is valid DQL. You hydrate the values as scalars. What is funny is why it even returns an object in this case.

          Show
          beberlei Benjamin Eberlei added a comment - The incrementation of the return value is a bug, but SELECT g.id, g.name is valid DQL. You hydrate the values as scalars. What is funny is why it even returns an object in this case.
          Hide
          guilhermeblanco Guilherme Blanco added a comment -

          Added failing test case.
          Currently it is not easily doable without larger refactoring of Hydrators.
          I'll keep this opened, but my 2 attempts failed.

          Show
          guilhermeblanco Guilherme Blanco added a comment - Added failing test case. Currently it is not easily doable without larger refactoring of Hydrators. I'll keep this opened, but my 2 attempts failed.
          guilhermeblanco Guilherme Blanco made changes -
          Field Original Value New Value
          Attachment IteratableHydratorTest.php [ 11128 ]
          Hide
          guilhermeblanco Guilherme Blanco added a comment -

          Scheduled for 3.0 since we're going to refactor the hydrators

          Show
          guilhermeblanco Guilherme Blanco added a comment - Scheduled for 3.0 since we're going to refactor the hydrators
          guilhermeblanco Guilherme Blanco made changes -
          Fix Version/s 3.0 [ 10129 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira [ 12890 ] jira-feedback [ 13955 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira-feedback [ 13955 ] jira-feedback2 [ 15819 ]
          beberlei Benjamin Eberlei made changes -
          Workflow jira-feedback2 [ 15819 ] jira-feedback3 [ 18075 ]
          Hide
          beberlei Benjamin Eberlei added a comment -

          Duplicate of DDC-2133 (better description)

          Show
          beberlei Benjamin Eberlei added a comment - Duplicate of DDC-2133 (better description)
          beberlei Benjamin Eberlei made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]
          beberlei Benjamin Eberlei made changes -
          Link This issue duplicates DDC-2133 [ DDC-2133 ]

          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={expand=changesets[0:20].revisions[0:29],reviews, query=DDC-1314}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

            People

            • Assignee:
              beberlei Benjamin Eberlei
              Reporter:
              daniel.beresh Daniel Beresh
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: