Highlighted intention of converting scalar types during single scalar or scalar hydration, but leaving it commented and added a note about the BC reason why we cannot do that for 2.X series.
This commit is contained in:
parent
9ec54b8fed
commit
a4dac7a292
@ -392,6 +392,7 @@ abstract class AbstractHydrator
|
||||
// NOTE: During scalar hydration, most of the times it's a scalar mapping, keep it first!!!
|
||||
case (isset($this->_rsm->scalarMappings[$key])):
|
||||
$cache[$key]['fieldName'] = $this->_rsm->scalarMappings[$key];
|
||||
$cache[$key]['type'] = Type::getType($this->_rsm->typeMappings[$key]);
|
||||
$cache[$key]['isScalar'] = true;
|
||||
break;
|
||||
|
||||
@ -422,17 +423,27 @@ abstract class AbstractHydrator
|
||||
|
||||
switch (true) {
|
||||
case (isset($cache[$key]['isScalar'])):
|
||||
// WARNING: BC break! We know this is the desired behavior to type convert values, but this
|
||||
// erroneous behavior exists since 2.0 and we're forced to keep compatibility. For 3.0 release,
|
||||
// uncomment these 2 lines of code.
|
||||
//$type = $cache[$key]['type'];
|
||||
//$value = $type->convertToPHPValue($value, $this->_platform);
|
||||
|
||||
$rowData[$fieldName] = $value;
|
||||
break;
|
||||
|
||||
case (isset($cache[$key]['isMetaColumn'])):
|
||||
$rowData[$cache[$key]['dqlAlias'] . '_' . $fieldName] = $value;
|
||||
$dqlAlias = $cache[$key]['dqlAlias'];
|
||||
|
||||
$rowData[$dqlAlias . '_' . $fieldName] = $value;
|
||||
break;
|
||||
|
||||
default:
|
||||
$value = $cache[$key]['type']->convertToPHPValue($value, $this->_platform);
|
||||
$dqlAlias = $cache[$key]['dqlAlias'];
|
||||
$type = $cache[$key]['type'];
|
||||
$value = $type->convertToPHPValue($value, $this->_platform);
|
||||
|
||||
$rowData[$cache[$key]['dqlAlias'] . '_' . $fieldName] = $value;
|
||||
$rowData[$dqlAlias . '_' . $fieldName] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user