1
0
mirror of synced 2025-02-09 08:49:26 +03:00

#6303 #6304 documenting why collisions in field name hydration in STI/JTI require additional information and checks in the hydration process

This commit is contained in:
Marco Pivetta 2017-08-19 18:30:33 +02:00
parent 4cbcdb761a
commit 44f2e22f14
No known key found for this signature in database
GPG Key ID: 4167D3337FD9D629

View File

@ -294,6 +294,8 @@ abstract class AbstractHydrator
$dqlAlias = $cacheKeyInfo['dqlAlias'];
$type = $cacheKeyInfo['type'];
// If there are field name collisions in the child class, then we need
// to only hydrate if we are looking at the correct discriminator value
if(
isset($cacheKeyInfo['discriminatorColumn']) &&
isset($data[$cacheKeyInfo['discriminatorColumn']]) &&
@ -392,7 +394,9 @@ abstract class AbstractHydrator
'dqlAlias' => $ownerMap,
];
if($classMetadata->parentClasses && isset($this->_rsm->discriminatorColumns[$ownerMap])) {
// the current discriminator value must be saved in order to disambiguate fields hydration,
// should there be field name collisions
if ($classMetadata->parentClasses && isset($this->_rsm->discriminatorColumns[$ownerMap])) {
return $this->_cache[$key] = \array_merge(
$columnInfo,
[