Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1314

DQL permits partial select using SQL

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor 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

            People

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

              Dates

              • Created:
                Updated:
                Resolved: