Commit 3045507a authored by Roman S. Borschel's avatar Roman S. Borschel

[DDC-593] Fixed.

parent 3b01277f
......@@ -1620,7 +1620,7 @@ class SqlWalker implements TreeWalker
{
return ($arithmeticExpr->isSimpleArithmeticExpression())
? $this->walkSimpleArithmeticExpression($arithmeticExpr->simpleArithmeticExpression)
: $this->walkSubselect($arithmeticExpr->subselect);
: '(' . $this->walkSubselect($arithmeticExpr->subselect) . ')';
}
/**
......
......@@ -325,6 +325,17 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
/**
* @group DDC-593
*/
public function testSubqueriesInComparisonExpression()
{
$this->assertSqlGeneration(
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE (u.id >= (SELECT u2.id FROM Doctrine\Tests\Models\CMS\CmsUser u2 WHERE u2.name = :name)) AND (u.id <= (SELECT u3.id FROM Doctrine\Tests\Models\CMS\CmsUser u3 WHERE u3.name = :name))',
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_ WHERE (c0_.id >= (SELECT c1_.id FROM cms_users c1_ WHERE c1_.name = ?)) AND (c0_.id <= (SELECT c2_.id FROM cms_users c2_ WHERE c2_.name = ?))'
);
}
public function testSupportsMemberOfExpression()
{
// "Get all users who have $phone as a phonenumber." (*cough* doesnt really make sense...)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment