1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Fixed DDC-1539

This commit is contained in:
Fabio B. Silva 2011-12-20 10:31:00 -02:00
parent 772f58a95b
commit 24dc74a800
2 changed files with 21 additions and 2 deletions

View File

@ -2149,8 +2149,8 @@ class Parser
// Peek beyond the matching closing paranthesis ')'
$peek = $this->_peekBeyondClosingParenthesis();
if (in_array($peek['value'], array("=", "<", "<=", "<>", ">", ">=", "!=")) ||
if (in_array($peek['value'], array("=", "<", "<=", "<>", ">", ">=", "!=", "!=")) || $this->_isMathOperator($peek) ||
in_array($peek['type'], array(Lexer::T_NOT, Lexer::T_BETWEEN, Lexer::T_LIKE, Lexer::T_IN, Lexer::T_IS, Lexer::T_EXISTS))) {
$condPrimary->simpleConditionalExpression = $this->SimpleConditionalExpression();

View File

@ -1415,6 +1415,25 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
/**
* @group DDC-1539
*/
public function testParenthesesOnTheLeftHandOfComparison()
{
$this->assertSqlGeneration(
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u where ( (u.id + u.id) * u.id ) > 100',
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_ WHERE (c0_.id + c0_.id) * c0_.id > 100'
);
$this->assertSqlGeneration(
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u where (u.id + u.id) * u.id > 100',
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_ WHERE (c0_.id + c0_.id) * c0_.id > 100'
);
$this->assertSqlGeneration(
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u where 100 < (u.id + u.id) * u.id ',
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_ WHERE 100 < (c0_.id + c0_.id) * c0_.id'
);
}
public function testCustomTypeValueSql()
{
if (DBALType::hasType('negative_to_positive')) {