1
0
mirror of synced 2025-01-09 18:47:10 +03:00

Arbitrary Join count walkers solution

Possible solution for Arbitrary Join problem in pagination count
walkers:
https://groups.google.com/forum/#!topic/doctrine-user/rpPYCDNKOU8

Added a condition to test query component against  SelectStatement from
clause
This commit is contained in:
František Bereň 2014-07-30 09:56:22 +02:00
parent 089cca636e
commit 114bd2435f
2 changed files with 20 additions and 2 deletions

View File

@ -57,7 +57,16 @@ class CountWalker extends TreeWalkerAdapter
&& $qComp['nestingLevel'] == 0 && $qComp['nestingLevel'] == 0
; ;
if ($isParent) { if ($isParent) {
$rootComponents[] = array($dqlAlias => $qComp); foreach($AST->fromClause->identificationVariableDeclarations as $identificationVariableDeclaration) {
$isRoot = $identificationVariableDeclaration->rangeVariableDeclaration
&& $identificationVariableDeclaration->rangeVariableDeclaration->aliasIdentificationVariable == $dqlAlias
&& $identificationVariableDeclaration->rangeVariableDeclaration->isRoot
;
if ($isRoot) {
$rootComponents[] = array($dqlAlias => $qComp);
break;
}
}
} }
} }
if (count($rootComponents) > 1) { if (count($rootComponents) > 1) {

View File

@ -78,7 +78,16 @@ class WhereInWalker extends TreeWalkerAdapter
&& $qComp['nestingLevel'] == 0 && $qComp['nestingLevel'] == 0
; ;
if ($isParent) { if ($isParent) {
$rootComponents[] = array($dqlAlias => $qComp); foreach($AST->fromClause->identificationVariableDeclarations as $identificationVariableDeclaration) {
$isRoot = $identificationVariableDeclaration->rangeVariableDeclaration
&& $identificationVariableDeclaration->rangeVariableDeclaration->aliasIdentificationVariable == $dqlAlias
&& $identificationVariableDeclaration->rangeVariableDeclaration->isRoot
;
if ($isRoot) {
$rootComponents[] = array($dqlAlias => $qComp);
break;
}
}
} }
} }
if (count($rootComponents) > 1) { if (count($rootComponents) > 1) {