From af2f556fd352025d3f3356d3680c172021017d66 Mon Sep 17 00:00:00 2001 From: "Fabio B. Silva" Date: Sat, 21 Jul 2012 18:07:56 -0300 Subject: [PATCH] small refactory --- lib/Doctrine/ORM/Query/SqlWalker.php | 9 +++------ tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index c6eb8e2cb..9c8f870e6 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -82,7 +82,7 @@ class SqlWalker implements TreeWalker * * @var integer */ - private $newObjectCounter; + private $newObjectCounter = 0; /** * @var ParserResult @@ -1409,15 +1409,12 @@ class SqlWalker implements TreeWalker $objIndex = $this->newObjectCounter ++; foreach ($newObjectExpression->args as $argIndex => $e) { - $resultAlias = $this->scalarResultCounter++; - $columnAlias = $this->getSQLColumnAlias('sclr') . $resultAlias; - $resultAliasMap = $this->scalarResultAliasMap; + $resultAlias = $this->scalarResultCounter++; + $columnAlias = $this->getSQLColumnAlias('sclr') . $resultAlias; switch (true) { case $e instanceof AST\NewObjectExpression: - $sqlSelectExpressions[] = $e->dispatch($this); - break; default: diff --git a/tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php b/tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php index 3d563cb22..a7668df0d 100644 --- a/tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/NewOperatorTest.php @@ -141,7 +141,7 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase new Doctrine\Tests\Models\CMS\CmsUserDTO( u.name, e.email, - new Doctrine\Tests\Models\CMS\CmsUserDTO( + new Doctrine\Tests\Models\CMS\CmsAddressDTO( a.country, a.city, a.zip @@ -186,7 +186,7 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase JOIN u.phonenumbers p GROUP BY - u + u, e, a ORDER BY u.name";