1
0
mirror of synced 2024-12-13 22:56:04 +03:00

[DDC-593] Fixed.

This commit is contained in:
Roman S. Borschel 2010-05-16 13:30:40 +02:00
parent 3b01277fd4
commit 3045507a9b
2 changed files with 12 additions and 1 deletions

View File

@ -1620,7 +1620,7 @@ class SqlWalker implements TreeWalker
{
return ($arithmeticExpr->isSimpleArithmeticExpression())
? $this->walkSimpleArithmeticExpression($arithmeticExpr->simpleArithmeticExpression)
: $this->walkSubselect($arithmeticExpr->subselect);
: '(' . $this->walkSubselect($arithmeticExpr->subselect) . ')';
}
/**

View File

@ -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...)