1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Merge branch 'DDC-1036'

This commit is contained in:
Guilherme Blanco 2011-02-20 01:44:27 -03:00
commit 99c7924292
3 changed files with 10 additions and 2 deletions

View File

@ -2390,7 +2390,7 @@ class Parser
$functionName = $this->_lexer->token['value'];
$this->match(Lexer::T_OPEN_PARENTHESIS);
$pathExp = $this->StateFieldPathExpression();
$pathExp = $this->SimpleArithmeticExpression();
$this->match(Lexer::T_CLOSE_PARENTHESIS);
}

View File

@ -1243,7 +1243,7 @@ class SqlWalker implements TreeWalker
public function walkAggregateExpression($aggExpression)
{
return $aggExpression->functionName . '(' . ($aggExpression->isDistinct ? 'DISTINCT ' : '')
. $this->walkPathExpression($aggExpression->pathExpression) . ')';
. $this->walkSimpleArithmeticExpression($aggExpression->pathExpression) . ')';
}
/**

View File

@ -209,6 +209,14 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
public function testSupportsAggregateFunctionWithSimpleArithmetic()
{
$this->assertSqlGeneration(
'SELECT MAX(u.id + 4) * 2 FROM Doctrine\Tests\Models\CMS\CmsUser u',
'SELECT MAX(c0_.id + 4) * 2 AS sclr0 FROM cms_users c0_'
);
}
public function testSupportsWhereClauseWithPositionalParameter()
{
$this->assertSqlGeneration(