From 56b3c0e8b02b0a07944e15cf66bf223d78a0d9f3 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Wed, 28 Jul 2010 21:57:05 +0200 Subject: [PATCH] DDC-644 - Added missing code for the _getScalarRowData() --- lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php | 4 ++++ tests/Doctrine/Tests/ORM/Functional/QueryTest.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php index 904c57878..5ce462158 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/AbstractHydrator.php @@ -249,6 +249,10 @@ abstract class AbstractHydrator $cache[$key]['fieldName'] = $fieldName; $cache[$key]['type'] = Type::getType($classMetadata->fieldMappings[$fieldName]['type']); $cache[$key]['dqlAlias'] = $this->_rsm->columnOwnerMap[$key]; + } else if (!isset($this->_rsm->metaMappings[$key])) { + // this column is a left over, maybe from a LIMIT query hack for example in Oracle or DB2 + // maybe from an additional column that has not been defined in a NativeQuery ResultSetMapping. + continue; } else { // Meta column (has meaning in relational schema only, i.e. foreign keys or discriminator columns). $cache[$key]['isMetaColumn'] = true; diff --git a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php index caeca159b..9995d0560 100644 --- a/tests/Doctrine/Tests/ORM/Functional/QueryTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/QueryTest.php @@ -297,6 +297,11 @@ class QueryTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals(2, count($data)); $this->assertEquals('gblanco3', $data[0]->username); $this->assertEquals('gblanco4', $data[1]->username); + + $data = $this->_em->createQuery('SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u') + ->setFirstResult(3) + ->setMaxResults(2) + ->getScalarResult(); } public function testSupportsQueriesWithEntityNamespaces()