From 35c8cd7f237a9a114303d14d573a28fb7d91b35e Mon Sep 17 00:00:00 2001 From: Guilherme Blanco Date: Fri, 25 Apr 2014 05:22:33 +0000 Subject: [PATCH] Added type conversion to meta column in case a type is specified (such as a foreign key or discriminator column). --- .../ORM/Internal/Hydration/AbstractHydrator.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php index 15c573e7d..adf7cd2e7 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php @@ -197,10 +197,11 @@ abstract class AbstractHydrator */ protected function cleanup() { - $this->_rsm = null; - $this->_stmt->closeCursor(); - $this->_stmt = null; + + $this->_stmt = null; + $this->_rsm = null; + $this->_cache = array(); } /** @@ -277,6 +278,7 @@ abstract class AbstractHydrator case (isset($cacheKeyInfo['isMetaColumn'])): $dqlAlias = $cacheKeyInfo['dqlAlias']; $fieldName = $cacheKeyInfo['fieldName']; + $type = $cacheKeyInfo['type']; // Avoid double setting or null assignment if (isset($rowData['data'][$dqlAlias][$fieldName]) || $value === null) { @@ -288,6 +290,10 @@ abstract class AbstractHydrator $nonemptyComponents[$dqlAlias] = true; } + if ($type) { + $value = $type->convertToPHPValue($value, $this->_platform); + } + $rowData['data'][$dqlAlias][$fieldName] = $value; break; @@ -359,6 +365,11 @@ abstract class AbstractHydrator case (isset($cacheKeyInfo['isMetaColumn'])): $dqlAlias = $cacheKeyInfo['dqlAlias']; + $type = $cacheKeyInfo['type']; + + if ($type) { + $value = $type->convertToPHPValue($value, $this->_platform); + } $rowData[$dqlAlias . '_' . $fieldName] = $value; break;