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

Changed calling $from[0] to using reset($from)

changed usage $from[0] according suggestion from @Ocramius  to use array
reset function
This commit is contained in:
František Bereň 2014-09-02 08:39:29 +02:00
parent d48be34696
commit 589d26fc5e
5 changed files with 10 additions and 5 deletions

View file

@ -96,7 +96,8 @@ class CountOutputWalker extends SqlWalker
throw new \RuntimeException("Cannot count query which selects two FROM components, cannot make distinction");
}
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $this->queryComponents[$rootAlias]['metadata'];
$rootIdentifier = $rootClass->identifier;

View file

@ -58,7 +58,8 @@ class CountWalker extends TreeWalkerAdapter
throw new \RuntimeException("Cannot count query which selects two FROM components, cannot make distinction");
}
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$identifierFieldName = $rootClass->getSingleIdentifierFieldName();

View file

@ -122,7 +122,8 @@ class LimitSubqueryOutputWalker extends SqlWalker
throw new \RuntimeException("Cannot count query which selects two FROM components, cannot make distinction");
}
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $this->queryComponents[$rootAlias]['metadata'];
$rootIdentifier = $rootClass->identifier;

View file

@ -63,7 +63,8 @@ class LimitSubqueryWalker extends TreeWalkerAdapter
$queryComponents = $this->_getQueryComponents();
// Get the root entity and alias from the AST fromClause
$from = $AST->fromClause->identificationVariableDeclarations;
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$selectExpressions = array();

View file

@ -79,7 +79,8 @@ class WhereInWalker extends TreeWalkerAdapter
throw new \RuntimeException("Cannot count query which selects two FROM components, cannot make distinction");
}
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$fromRoot = reset($from);
$rootAlias = $fromRoot->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$identifierFieldName = $rootClass->getSingleIdentifierFieldName();