diff --git a/lib/Doctrine/ORM/Query/Expr/Select.php b/lib/Doctrine/ORM/Query/Expr/Select.php index fb049916f..a310a0c7b 100644 --- a/lib/Doctrine/ORM/Query/Expr/Select.php +++ b/lib/Doctrine/ORM/Query/Expr/Select.php @@ -36,4 +36,7 @@ class Select extends Base { protected $_preSeparator = ''; protected $_postSeparator = ''; + protected $_allowedClasses = array( + 'Doctrine\ORM\Query\Expr\Func' + ); } \ No newline at end of file diff --git a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php index 468e0e20c..e2430e8cc 100644 --- a/tests/Doctrine/Tests/ORM/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/ORM/QueryBuilderTest.php @@ -516,4 +516,13 @@ class QueryBuilderTest extends \Doctrine\Tests\OrmTestCase $this->assertEquals(QueryBuilder::STATE_DIRTY, $qb->getState()); } + + public function testSelectWithFuncExpression() + { + $qb = $this->_em->createQueryBuilder(); + $expr = $qb->expr(); + $qb->select($expr->count('e.id')); + + $this->assertValidQueryBuilder($qb, 'SELECT COUNT(e.id)'); + } } \ No newline at end of file