Details
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
- duplicates
-
DDC-2133
Issue with Query::iterate and query mixed results
-
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.