1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

[DDC-1036] Modified the AggregateExpressions to support SimpleArithmeticExpression instead of StateFieldPathExpression.

This commit is contained in:
Guilherme Blanco 2011-02-20 01:44:05 -03:00
parent bca927f861
commit 505d9e2154
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(