1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00
This commit is contained in:
František Bereň 2014-08-28 13:17:25 +02:00
parent 54ac6a0535
commit d48be34696
3 changed files with 8 additions and 5 deletions

View file

@ -53,12 +53,13 @@ class CountWalker extends TreeWalkerAdapter
$queryComponents = $this->_getQueryComponents();
// Get the root entity and alias from the AST fromClause
$from = $AST->fromClause->identificationVariableDeclarations;
if (count($from) > 1) {
throw new \RuntimeException("Cannot count query which selects two FROM components, cannot make distinction");
}
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$identifierFieldName = $rootClass->getSingleIdentifierFieldName();
$pathType = PathExpression::TYPE_STATE_FIELD;

View file

@ -62,7 +62,7 @@ class LimitSubqueryWalker extends TreeWalkerAdapter
{
$queryComponents = $this->_getQueryComponents();
// Get the root entity and alias from the AST fromClause
$from = $AST->fromClause->identificationVariableDeclarations;
$from = $AST->fromClause->identificationVariableDeclarations;
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$selectExpressions = array();
@ -76,6 +76,7 @@ class LimitSubqueryWalker extends TreeWalkerAdapter
}
$identifier = $rootClass->getSingleIdentifierFieldName();
if (isset($rootClass->associationMappings[$identifier])) {
throw new \RuntimeException("Paginating an entity with foreign key as identifier only works when using the Output Walkers. Call Paginator#setUseOutputWalkers(true) before iterating the paginator.");
}

View file

@ -74,12 +74,13 @@ class WhereInWalker extends TreeWalkerAdapter
$queryComponents = $this->_getQueryComponents();
// Get the root entity and alias from the AST fromClause
$from = $AST->fromClause->identificationVariableDeclarations;
if (count($from) > 1) {
throw new \RuntimeException("Cannot count query which selects two FROM components, cannot make distinction");
}
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$rootAlias = $from[0]->rangeVariableDeclaration->aliasIdentificationVariable;
$rootClass = $queryComponents[$rootAlias]['metadata'];
$identifierFieldName = $rootClass->getSingleIdentifierFieldName();
$pathType = PathExpression::TYPE_STATE_FIELD;