doctrine1 icon indicating copy to clipboard operation
doctrine1 copied to clipboard

fix(Hydrator): Array hydration having always primary key and selected relations

Open alquerci opened this issue 1 year ago • 2 comments

Fixes #134

alquerci avatar Apr 15 '24 18:04 alquerci

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',
) 

alquerci avatar Apr 15 '24 18:04 alquerci

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.

alquerci avatar Apr 16 '24 06:04 alquerci