#1188 - Simplified and optimized parameter un-setting logic
This commit is contained in:
parent
8b5dae30a5
commit
df99353f19
@ -258,13 +258,19 @@ class Paginator implements \Countable, \IteratorAggregate
|
|||||||
|
|
||||||
$parser = new Parser($countQuery);
|
$parser = new Parser($countQuery);
|
||||||
$parameterMappings = $parser->parse()->getParameterMappings();
|
$parameterMappings = $parser->parse()->getParameterMappings();
|
||||||
$parameters = $countQuery->getParameters();
|
/* @var $parameters \Doctrine\Common\Collections\Collection|\Doctrine\ORM\Query\Parameter[] */
|
||||||
foreach ($parameters as $k => $param){
|
$parameters = $countQuery->getParameters();
|
||||||
if( ! array_key_exists($param->getName(), $parameterMappings)) {
|
|
||||||
$parameters->remove($k);
|
foreach ($parameters as $key => $parameter) {
|
||||||
|
$parameterName = $parameter->getName();
|
||||||
|
|
||||||
|
if( ! (isset($parameterMappings[$parameterName]) || array_key_exists($parameterName, $parameterMappings))) {
|
||||||
|
unset($parameters[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$countQuery->setParameters($parameters);
|
$countQuery->setParameters($parameters);
|
||||||
|
|
||||||
return $countQuery;
|
return $countQuery;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user