From 248022249fdcc1869293b04878ccfa9243353e1a Mon Sep 17 00:00:00 2001 From: beberlei Date: Thu, 25 Feb 2010 20:31:53 +0000 Subject: [PATCH] [2.0] DDC-375 - Fix a little bug in walkSimpleSelectExpression --- lib/Doctrine/ORM/Query/SqlWalker.php | 2 +- tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Query/SqlWalker.php b/lib/Doctrine/ORM/Query/SqlWalker.php index c577bc9a1..118037c07 100644 --- a/lib/Doctrine/ORM/Query/SqlWalker.php +++ b/lib/Doctrine/ORM/Query/SqlWalker.php @@ -1052,7 +1052,7 @@ class SqlWalker implements TreeWalker $sql .= ' ' . $this->walkPathExpression($expr); } else if ($expr instanceof AST\AggregateExpression) { if ( ! $simpleSelectExpression->fieldIdentificationVariable) { - $alias = $this->_scalarAliasCounter++; + $alias = $this->_scalarResultCounter++; } else { $alias = $simpleSelectExpression->fieldIdentificationVariable; } diff --git a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php index ba95cef7d..00db119a6 100644 --- a/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php +++ b/tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php @@ -582,7 +582,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase { $this->assertSqlGeneration( "SELECT u.name, (SELECT COUNT(p.phonenumber) FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p WHERE p.phonenumber = 1234) pcount FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name = 'jon'", - "SELECT c0_.name AS name0, (SELECT COUNT(c1_.phonenumber) AS dctrn__ FROM cms_phonenumbers c1_ WHERE c1_.phonenumber = 1234) AS sclr1 FROM cms_users c0_ WHERE c0_.name = 'jon'" + "SELECT c0_.name AS name0, (SELECT COUNT(c1_.phonenumber) AS dctrn__1 FROM cms_phonenumbers c1_ WHERE c1_.phonenumber = 1234) AS sclr1 FROM cms_users c0_ WHERE c0_.name = 'jon'" ); } }