[2.0] Optimized support to IdentificationVariable in ArithmeticPrimary
This commit is contained in:
parent
d045c6f6c1
commit
955dc09cb9
@ -41,7 +41,6 @@ namespace Doctrine\ORM\Query\AST;
|
|||||||
*/
|
*/
|
||||||
class PathExpression extends Node
|
class PathExpression extends Node
|
||||||
{
|
{
|
||||||
const TYPE_IDENTIFICATION_VARIABLE = 1;
|
|
||||||
const TYPE_COLLECTION_VALUED_ASSOCIATION = 2;
|
const TYPE_COLLECTION_VALUED_ASSOCIATION = 2;
|
||||||
const TYPE_SINGLE_VALUED_ASSOCIATION = 4;
|
const TYPE_SINGLE_VALUED_ASSOCIATION = 4;
|
||||||
const TYPE_STATE_FIELD = 8;
|
const TYPE_STATE_FIELD = 8;
|
||||||
|
@ -557,16 +557,20 @@ class Parser
|
|||||||
{
|
{
|
||||||
foreach ($this->_deferredPathExpressions as $deferredItem) {
|
foreach ($this->_deferredPathExpressions as $deferredItem) {
|
||||||
$pathExpression = $deferredItem['expression'];
|
$pathExpression = $deferredItem['expression'];
|
||||||
$parts = $pathExpression->parts;
|
|
||||||
$numParts = count($parts);
|
|
||||||
|
|
||||||
$qComp = $this->_queryComponents[$pathExpression->identificationVariable];
|
$qComp = $this->_queryComponents[$pathExpression->identificationVariable];
|
||||||
|
$numParts = count($pathExpression->parts);
|
||||||
|
|
||||||
|
if ($numParts == 0) {
|
||||||
|
$pathExpression->parts = array($qComp['metadata']->identifier[0]);
|
||||||
|
$numParts++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$parts = $pathExpression->parts;
|
||||||
$aliasIdentificationVariable = $pathExpression->identificationVariable;
|
$aliasIdentificationVariable = $pathExpression->identificationVariable;
|
||||||
$parentField = $pathExpression->identificationVariable;
|
$parentField = $pathExpression->identificationVariable;
|
||||||
$class = $qComp['metadata'];
|
$class = $qComp['metadata'];
|
||||||
$fieldType = ($pathExpression->expectedType == AST\PathExpression::TYPE_IDENTIFICATION_VARIABLE)
|
$fieldType = null;
|
||||||
? AST\PathExpression::TYPE_IDENTIFICATION_VARIABLE : null;
|
|
||||||
$curIndex = 0;
|
$curIndex = 0;
|
||||||
|
|
||||||
foreach ($parts as $field) {
|
foreach ($parts as $field) {
|
||||||
@ -650,11 +654,6 @@ class Parser
|
|||||||
// We need to recognize which was expected type(s)
|
// We need to recognize which was expected type(s)
|
||||||
$expectedStringTypes = array();
|
$expectedStringTypes = array();
|
||||||
|
|
||||||
// Validate state field type
|
|
||||||
if ($expectedType & AST\PathExpression::TYPE_IDENTIFICATION_VARIABLE) {
|
|
||||||
$expectedStringTypes[] = 'IdentificationVariable';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate state field type
|
// Validate state field type
|
||||||
if ($expectedType & AST\PathExpression::TYPE_STATE_FIELD) {
|
if ($expectedType & AST\PathExpression::TYPE_STATE_FIELD) {
|
||||||
$expectedStringTypes[] = 'StateFieldPathExpression';
|
$expectedStringTypes[] = 'StateFieldPathExpression';
|
||||||
@ -2174,7 +2173,7 @@ class Parser
|
|||||||
return $this->SingleValuedPathExpression();
|
return $this->SingleValuedPathExpression();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->PathExpression(AST\PathExpression::TYPE_IDENTIFICATION_VARIABLE);
|
return $this->SimpleStateFieldPathExpression();
|
||||||
|
|
||||||
case Lexer::T_INPUT_PARAMETER:
|
case Lexer::T_INPUT_PARAMETER:
|
||||||
return $this->InputParameter();
|
return $this->InputParameter();
|
||||||
|
@ -446,17 +446,6 @@ class SqlWalker implements TreeWalker
|
|||||||
$sql = '';
|
$sql = '';
|
||||||
|
|
||||||
switch ($pathExpr->type) {
|
switch ($pathExpr->type) {
|
||||||
case AST\PathExpression::TYPE_IDENTIFICATION_VARIABLE:
|
|
||||||
$dqlAlias = $pathExpr->identificationVariable;
|
|
||||||
$class = $this->_queryComponents[$dqlAlias]['metadata'];
|
|
||||||
|
|
||||||
if ($this->_useSqlTableAliases) {
|
|
||||||
$sql .= $this->walkIdentificationVariable($dqlAlias) . '.';
|
|
||||||
}
|
|
||||||
|
|
||||||
$sql .= $class->getQuotedColumnName($class->identifier[0], $this->_platform);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case AST\PathExpression::TYPE_STATE_FIELD:
|
case AST\PathExpression::TYPE_STATE_FIELD:
|
||||||
$parts = $pathExpr->parts;
|
$parts = $pathExpr->parts;
|
||||||
$fieldName = array_pop($parts);
|
$fieldName = array_pop($parts);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user