Skip to content

Commit 02314ab

Browse files
committed
Array hydration add identifier on select SQL of selected relation
1 parent 15606f5 commit 02314ab

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/Doctrine/Query.php

+5
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,11 @@ public function parseSelect($dql)
669669
}
670670
}
671671

672+
$this->appendRelationIdentifierOnSqlSelect();
673+
}
674+
675+
private function appendRelationIdentifierOnSqlSelect()
676+
{
672677
if (Doctrine_Core::HYDRATE_ARRAY === $this->_hydrator->getHydrationMode()) {
673678
foreach ($this->_queryComponents as $componentAlias => $queryComponent) {
674679
if (isset($queryComponent['relation']) && isset($queryComponent['agg'])) {

tests/Ticket/GH134TestCase.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ class Doctrine_Ticket_GH134_TestCase extends Doctrine_UnitTestCase
44
{
55
public function test_addIdentifierForSelectedRelation_withAliases()
66
{
7-
foreach ($this->provideIdentifierAndRelationData() as [$hydrateType, $expectedSql, $expectedFirstResult]) {
7+
foreach ($this->provideIdentifierAndRelationWithAliasData() as [$hydrateType, $expectedSql, $expectedFirstResult]) {
88
$query = Doctrine_Query::create()
99
->select('u.id, e.address as aliasAddress')
1010
->from('User u')
@@ -20,7 +20,7 @@ public function test_addIdentifierForSelectedRelation_withAliases()
2020
}
2121
}
2222

23-
private function provideIdentifierAndRelationData()
23+
private function provideIdentifierAndRelationWithAliasData()
2424
{
2525
yield [
2626
Doctrine_Core::HYDRATE_ARRAY,

0 commit comments

Comments
 (0)