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
-
Activity
Oleg Namaka
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Affects Version/s | 2.2.1 [ 10194 ] | |
| Component/s | ORM [ 10012 ] |
Oleg Namaka
made changes -
| Description |
Consider this code:
{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']; } {code} First result keys are: {code} Array ( [0] => 0 [1] => name ) {code} but all others are just: {code} Array ( [0] => 0 ) {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Consider this code:
{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']; } {code} This results with undefined index: 'nam'e for the second entry. First result keys are: {code} Array ( [0] => 0 [1] => name ) {code} but all others are just: {code} Array ( [0] => 0 ) {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Oleg Namaka
made changes -
| Description |
Consider this code:
{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']; } {code} This results with undefined index: 'nam'e for the second entry. First result keys are: {code} Array ( [0] => 0 [1] => name ) {code} but all others are just: {code} Array ( [0] => 0 ) {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are: {code} Array ( [0] => 0 [1] => name ) {code} but all others are just: {code} Array ( [0] => 0 ) {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Oleg Namaka
made changes -
| Description |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are: {code} Array ( [0] => 0 [1] => name ) {code} but all others are just: {code} Array ( [0] => 0 ) {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are: {code} 0 array(1) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different: {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Oleg Namaka
made changes -
| Description |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are: {code} 0 array(1) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different: {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are (notice just one array element with index 0): {code} 0 array(1) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different ((notice just two array elements with index 0 and the other one that is incrementing)): {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Oleg Namaka
made changes -
| Description |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are (notice just one array element with index 0): {code} 0 array(1) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different ((notice just two array elements with index 0 and the other one that is incrementing)): {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are (notice just one array element with index 0): {code} 0 array(1) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different (notice just two array elements with index 0 and the other one that is incrementing): {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Oleg Namaka
made changes -
| Description |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are (notice just one array element with index 0): {code} 0 array(1) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different (notice just two array elements with index 0 and the other one that is incrementing): {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are (notice just one array element with index 0): {code} 0 array(1) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different (notice two array elements with index 0 and the other one that is incrementing): {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Oleg Namaka
made changes -
| Description |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are (notice just one array element with index 0): {code} 0 array(1) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different (notice two array elements with index 0 and the other one that is incrementing): {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Consider this code:
{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']; } {code} This results with undefined index: 'name' for the second entry. First result keys are (notice just one array element with index 0): {code} 0 array(2) { [0] => int(0) [1] => string(4) "name" } {code} but all others are different (notice two array elements with index 0 and the other one that is incrementing): {code} 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" } {code} What's wrong with this approach? Is it a bug or mixed results should not be used with the iterate method? |
Benjamin Eberlei
made changes -
| Fix Version/s | 3.0 [ 10129 ] |
Benjamin Eberlei
made changes -
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-2133, expand=changesets[-21:-1].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)
This is a known issue that we don't have found a BC fix for and as I understand Guilherme Blanco requires considerable refactoring.