Commit 8452108e authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Some code reordering, changes. Removed classMetadata from...

[2.0] Some code reordering, changes. Removed classMetadata from RangeVariableDeclaration, since it is against AST concept.
parent 7c6dc8b7
...@@ -34,14 +34,12 @@ namespace Doctrine\ORM\Query\AST; ...@@ -34,14 +34,12 @@ namespace Doctrine\ORM\Query\AST;
*/ */
class RangeVariableDeclaration extends Node class RangeVariableDeclaration extends Node
{ {
public $classMetadata;
public $abstractSchemaName; public $abstractSchemaName;
public $aliasIdentificationVariable; public $aliasIdentificationVariable;
public function __construct($classMetadata, $aliasIdentificationVar) public function __construct($abstractSchemaName, $aliasIdentificationVar)
{ {
$this->classMetadata = $classMetadata; $this->abstractSchemaName = $abstractSchemaName;
$this->abstractSchemaName = $classMetadata->name;
$this->aliasIdentificationVariable = $aliasIdentificationVar; $this->aliasIdentificationVariable = $aliasIdentificationVar;
} }
......
...@@ -67,7 +67,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor ...@@ -67,7 +67,7 @@ class MultiTableDeleteExecutor extends AbstractSqlExecutor
$this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')' $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')'
. ' SELECT t0.' . implode(', t0.', $idColumnNames); . ' SELECT t0.' . implode(', t0.', $idColumnNames);
$sqlWalker->setSqlTableAlias($primaryClass->primaryTable['name'] . $primaryDqlAlias, 't0'); $sqlWalker->setSqlTableAlias($primaryClass->primaryTable['name'] . $primaryDqlAlias, 't0');
$rangeDecl = new AST\RangeVariableDeclaration($primaryClass, $primaryDqlAlias); $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $primaryDqlAlias);
$fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array()))); $fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array())));
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause); $this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
......
...@@ -70,7 +70,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor ...@@ -70,7 +70,7 @@ class MultiTableUpdateExecutor extends AbstractSqlExecutor
$this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')' $this->_insertSql = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ')'
. ' SELECT t0.' . implode(', t0.', $idColumnNames); . ' SELECT t0.' . implode(', t0.', $idColumnNames);
$sqlWalker->setSqlTableAlias($primaryClass->primaryTable['name'] . $updateClause->aliasIdentificationVariable, 't0'); $sqlWalker->setSqlTableAlias($primaryClass->primaryTable['name'] . $updateClause->aliasIdentificationVariable, 't0');
$rangeDecl = new AST\RangeVariableDeclaration($primaryClass, $updateClause->aliasIdentificationVariable); $rangeDecl = new AST\RangeVariableDeclaration($primaryClass->name, $updateClause->aliasIdentificationVariable);
$fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array()))); $fromClause = new AST\FromClause(array(new AST\IdentificationVariableDeclaration($rangeDecl, null, array())));
$this->_insertSql .= $sqlWalker->walkFromClause($fromClause); $this->_insertSql .= $sqlWalker->walkFromClause($fromClause);
......
...@@ -601,11 +601,7 @@ class Parser ...@@ -601,11 +601,7 @@ class Parser
$token = ($token) ?: $this->_lexer->lookahead; $token = ($token) ?: $this->_lexer->lookahead;
if ( ! isset($this->_queryComponents[$identVariable])) { if ( ! isset($this->_queryComponents[$identVariable])) {
echo '[Query Components: ' . var_export($this->_queryComponents, true) . ']'; $this->semanticalError("'$idVariable' is not defined", $token);
$this->semanticalError(
"'$idVariable' is not defined", $token
);
} }
// Validate if identification variable nesting level is lower or equal than the current one // Validate if identification variable nesting level is lower or equal than the current one
...@@ -1402,9 +1398,7 @@ class Parser ...@@ -1402,9 +1398,7 @@ class Parser
); );
$this->_queryComponents[$aliasIdentificationVariable] = $queryComponent; $this->_queryComponents[$aliasIdentificationVariable] = $queryComponent;
return new AST\RangeVariableDeclaration( return new AST\RangeVariableDeclaration($abstractSchemaName, $aliasIdentificationVariable);
$classMetadata, $aliasIdentificationVariable
);
} }
/** /**
......
This diff is collapsed.
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