doctrine1
doctrine1 copied to clipboard
fix(Hydrator): Array hydration having always primary key and selected relations
Fixes #134
After revert #109 We got this failing tests see
Doctrine_Ticket_585_TestCase : method test_hydrateArray_withAllColumnsAliased_thenResultsHasAllRecords failed on line 68
Value1: array (
0 => 'aliasId',
1 => 'aliasName',
)
!=
Value2: array (
0 => 'id',
1 => 'aliasName',
2 => 'aliasId',
)
Doctrine_Ticket_GH134_TestCase : method test_hydrateArray_withAllColumnsAliased_thenResultsHasAllRecords failed on line 49
Value1: array (
0 => 'id',
1 => 'aliasAddress',
)
!=
Value2: array (
0 => 'id',
1 => 'aliasAddress',
2 => 'Email',
)
On previous behaviour the array hydration relation have the identifier, even if not explicitly given on DQL, https://github.com/FriendsOfSymfony1/doctrine1/pull/135/commits/8aef340dd1405fc74da3f918e77263004aa107f6
SELECT
rootAlias.id,
relationAlias.field
FROM RootRecord rootAlias
INNER JOIN RelationRecord relationAlias
After array hydration
- id: 'some-root-record-id'
RelationName:
id: 'some-relation-record-id'
field: 'some_relation_field_value'
So there is another rule not frozen by the actual test suite.
On Array hydration identifier of the relation is always present even when not explicitly on DQL select.