1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

DDC-1802 removed unnecessary tokens T_SIZE and T_MOD

This commit is contained in:
Martin Hasoň 2012-05-02 19:10:21 +02:00
parent 3ab6ad23ad
commit 3d852397db
4 changed files with 35 additions and 15 deletions

View file

@ -53,7 +53,7 @@ class ModFunction extends FunctionNode
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_MOD);
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->firstSimpleArithmeticExpression = $parser->SimpleArithmeticExpression();

View file

@ -109,7 +109,7 @@ class SizeFunction extends FunctionNode
*/
public function parse(\Doctrine\ORM\Query\Parser $parser)
{
$parser->match(Lexer::T_SIZE);
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
$this->collectionPathExpression = $parser->CollectionValuedPathExpression();

View file

@ -98,18 +98,16 @@ class Lexer extends \Doctrine\Common\Lexer
const T_OUTER = 144;
const T_SELECT = 145;
const T_SET = 146;
const T_SIZE = 147;
const T_SOME = 148;
const T_SUM = 149;
const T_THEN = 150;
const T_TRAILING = 151;
const T_TRUE = 152;
const T_UPDATE = 153;
const T_WHEN = 154;
const T_WHERE = 155;
const T_WITH = 156;
const T_PARTIAL = 157;
const T_MOD = 158;
const T_SOME = 147;
const T_SUM = 148;
const T_THEN = 149;
const T_TRAILING = 150;
const T_TRUE = 151;
const T_UPDATE = 152;
const T_WHEN = 153;
const T_WHERE = 154;
const T_WITH = 155;
const T_PARTIAL = 156;
/**
* Creates a new query scanner object.
@ -205,4 +203,4 @@ class Lexer extends \Doctrine\Common\Lexer
return $type;
}
}
}

View file

@ -374,6 +374,17 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
/**
* @group DDC-1802
*/
public function testSupportsNotBetweenForSizeFunction()
{
$this->assertSqlGeneration(
"SELECT m.name FROM Doctrine\Tests\Models\StockExchange\Market m WHERE SIZE(m.stocks) NOT BETWEEN ?1 AND ?2",
"SELECT e0_.name AS name0 FROM exchange_markets e0_ WHERE (SELECT COUNT(*) FROM exchange_stocks e1_ WHERE e1_.market_id = e0_.id) NOT BETWEEN ? AND ?"
);
}
public function testSupportsFunctionalExpressionsInWherePart()
{
$this->assertSqlGeneration(
@ -472,6 +483,17 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
/**
* @group DDC-1802
*/
public function testSupportsNotInExpressionForModFunction()
{
$this->assertSqlGeneration(
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE MOD(u.id, 5) NOT IN(1,3,4)",
"SELECT c0_.name AS name0 FROM cms_users c0_ WHERE MOD(c0_.id, 5) NOT IN (1, 3, 4)"
);
}
public function testInExpressionWithSingleValuedAssociationPathExpressionInWherePart()
{
$this->assertSqlGeneration(