Details
Description
Consider this code:
$dql = "
SELECT Page, Product.name
FROM Dlayer\\Entity\\Page Page
INNER JOIN Page.Product Product
";
$q = ($em->createQuery($dql));
foreach ($q->iterate() as $entry) {
$page = $entry[0][0];
$name = $entry[0]['name'];
}
This results with undefined index: 'name' for the second entry.
First result keys are (notice just one array element with index 0):
0
array(2) {
[0] =>
int(0)
[1] =>
string(4) "name"
}
but all others are different (notice two array elements with index 0 and the other one that is incrementing):
the second one:
0
array(1) {
[0] =>
int(0)
}
1
array(1) {
[0] =>
string(4) "name"
}
the third one:
0
array(1) {
[0] =>
int(0)
}
2
array(1) {
[0] =>
string(4) "name"
}
What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method?
Issue Links
- is duplicated by
-
DDC-1314
DQL permits partial select using SQL
-