Skip to content

Commit

Permalink
CS Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
František Bereň committed Aug 28, 2014
1 parent 54ac6a0 commit d48be34
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions lib/Doctrine/ORM/Tools/Pagination/CountWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ public function walkSelectStatement(SelectStatement $AST)
$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;
Expand Down
3 changes: 2 additions & 1 deletion lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function walkSelectStatement(SelectStatement $AST)
{
$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();
Expand All @@ -76,6 +76,7 @@ public function walkSelectStatement(SelectStatement $AST)
}

$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.");
}
Expand Down
5 changes: 3 additions & 2 deletions lib/Doctrine/ORM/Tools/Pagination/WhereInWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,13 @@ public function walkSelectStatement(SelectStatement $AST)
$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;
Expand Down

0 comments on commit d48be34

Please sign in to comment.