Implemented multiple enhancements in InExpression support for DQL. Fixed DDC-1472 and DDC-1416.
This commit is contained in:
parent
a26990c3e8
commit
0380d5ae58
@ -35,13 +35,13 @@ namespace Doctrine\ORM\Query\AST;
|
||||
class InExpression extends Node
|
||||
{
|
||||
public $not;
|
||||
public $pathExpression;
|
||||
public $expression;
|
||||
public $literals = array();
|
||||
public $subselect;
|
||||
|
||||
public function __construct($pathExpression)
|
||||
public function __construct($expression)
|
||||
{
|
||||
$this->pathExpression = $pathExpression;
|
||||
$this->expression = $expression;
|
||||
}
|
||||
|
||||
public function dispatch($sqlWalker)
|
||||
|
@ -2720,7 +2720,7 @@ class Parser
|
||||
*/
|
||||
public function InExpression()
|
||||
{
|
||||
$inExpression = new AST\InExpression($this->SingleValuedPathExpression());
|
||||
$inExpression = new AST\InExpression($this->ArithmeticExpression());
|
||||
|
||||
if ($this->_lexer->isNextToken(Lexer::T_NOT)) {
|
||||
$this->match(Lexer::T_NOT);
|
||||
|
@ -1727,8 +1727,7 @@ class SqlWalker implements TreeWalker
|
||||
*/
|
||||
public function walkInExpression($inExpr)
|
||||
{
|
||||
$sql = $this->walkPathExpression($inExpr->pathExpression)
|
||||
. ($inExpr->not ? ' NOT' : '') . ' IN (';
|
||||
$sql = $this->walkArithmeticExpression($inExpr->expression) . ($inExpr->not ? ' NOT' : '') . ' IN (';
|
||||
|
||||
$sql .= ($inExpr->subselect)
|
||||
? $this->walkSubselect($inExpr->subselect)
|
||||
|
@ -451,8 +451,8 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
||||
public function testSupportsSingleValuedInExpressionWithoutSpacesInWherePart()
|
||||
{
|
||||
$this->assertSqlGeneration(
|
||||
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN(46)",
|
||||
"SELECT c0_.name AS name0 FROM cms_users c0_ WHERE c0_.id IN (46)"
|
||||
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE IDENTITY(u.email) IN(46)",
|
||||
"SELECT c0_.name AS name0 FROM cms_users c0_ WHERE c0_.email_id IN (46)"
|
||||
);
|
||||
}
|
||||
|
||||
@ -467,8 +467,8 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
||||
public function testSupportsNotInExpressionInWherePart()
|
||||
{
|
||||
$this->assertSqlGeneration(
|
||||
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN (1)',
|
||||
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_ WHERE c0_.id NOT IN (1)'
|
||||
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :id NOT IN (1)',
|
||||
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_ WHERE ? NOT IN (1)'
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user