1
0
mirror of synced 2025-01-19 06:51:40 +03:00

Merge pull request #819 from vbourdeix/master

Fixes a Fatal Error when using a subexpression in parenthesis
This commit is contained in:
Guilherme Blanco 2013-10-14 11:01:51 -07:00
commit 95ad926c95
2 changed files with 11 additions and 0 deletions

View File

@ -1581,6 +1581,10 @@ class SqlWalker implements TreeWalker
$sql .= $expr->dispatch($this) . ' AS ' . $columnAlias;
break;
case ($expr instanceof AST\ParenthesisExpression):
$sql .= $this->walkParenthesisExpression($expr);
break;
default: // IdentificationVariable
$sql .= $this->walkEntityIdentificationVariable($expr);
break;

View File

@ -1641,6 +1641,13 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
public function testSupportsParenthesisExpressionInSubSelect() {
$this->assertSqlGeneration(
'SELECT u.id, (SELECT (1000*SUM(subU.id)/SUM(subU.id)) FROM Doctrine\Tests\Models\CMS\CmsUser subU where subU.id = u.id) AS subSelect FROM Doctrine\Tests\Models\CMS\CmsUser u',
'SELECT c0_.id AS id0, (SELECT (1000 * SUM(c1_.id) / SUM(c1_.id)) FROM cms_users c1_ WHERE c1_.id = c0_.id) AS sclr1 FROM cms_users c0_'
);
}
/**
* @group DDC-1557
*/