[2.0] Fixed support to ResultVariable usage in ArithmeticExpression.
This commit is contained in:
parent
0fde94ddcf
commit
bb94f6ea7c
3 changed files with 14 additions and 2 deletions
|
@ -2129,7 +2129,7 @@ class Parser
|
|||
/**
|
||||
* ArithmeticPrimary ::= SingleValuedPathExpression | Literal | "(" SimpleArithmeticExpression ")"
|
||||
* | FunctionsReturningNumerics | AggregateExpression | FunctionsReturningStrings
|
||||
* | FunctionsReturningDatetime | IdentificationVariable
|
||||
* | FunctionsReturningDatetime | ResultVariable
|
||||
*/
|
||||
public function ArithmeticPrimary()
|
||||
{
|
||||
|
@ -2154,7 +2154,7 @@ class Parser
|
|||
return $this->SingleValuedPathExpression();
|
||||
}
|
||||
|
||||
return $this->IdentificationVariable();
|
||||
return $this->ResultVariable();
|
||||
|
||||
case Lexer::T_INPUT_PARAMETER:
|
||||
return $this->InputParameter();
|
||||
|
|
|
@ -1639,6 +1639,10 @@ class SqlWalker implements TreeWalker
|
|||
$sql .= '(' . $this->walkSimpleArithmeticExpression($primary) . ')';
|
||||
} else if ($primary instanceof AST\Node) {
|
||||
$sql .= $primary->dispatch($this);
|
||||
} else if (is_string($primary)) {
|
||||
$columnName = $this->_queryComponents[$primary]['token']['value'];
|
||||
|
||||
$sql .= $this->_scalarResultAliasMap[$columnName];
|
||||
}
|
||||
|
||||
return $sql;
|
||||
|
|
|
@ -527,6 +527,14 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testSupportResultVariableInWherePart()
|
||||
{
|
||||
$this->assertSqlGeneration(
|
||||
"SELECT p.phonenumber, COUNT(p.user) AS total FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p WHERE total > 0 GROUP BY p.user",
|
||||
"SELECT c0_.phonenumber AS phonenumber0, COUNT(c0_.user_id) AS sclr1 FROM cms_phonenumbers c0_ WHERE sclr1 > 0 GROUP BY c0_.user_id"
|
||||
);
|
||||
}
|
||||
|
||||
public function testSingleValuedAssociationNullCheckOnOwningSide()
|
||||
{
|
||||
$this->assertSqlGeneration(
|
||||
|
|
Loading…
Add table
Reference in a new issue