Fixed counting exception
Fixed "Invalid parameter number: number of bound variables does not match number of tokens " exception during execution count on Query where select part of query contains :parameters.
This commit is contained in:
parent
bf5003f25e
commit
42aff75108
@ -140,6 +140,16 @@ class Paginator implements \Countable, \IteratorAggregate
|
||||
$countQuery->setFirstResult(null)->setMaxResults(null);
|
||||
|
||||
try {
|
||||
$parser = new Query\Parser($countQuery);
|
||||
$parameterMappings = $parser->parse($parser)->getParameterMappings();
|
||||
$parameters = $countQuery->getParameters();
|
||||
foreach($parameters as $k=>$param){
|
||||
if(!array_key_exists($param->getName(), $parameterMappings)){
|
||||
$parameters->remove($k);
|
||||
}
|
||||
}
|
||||
$countQuery->setParameters($parameters);
|
||||
|
||||
$data = $countQuery->getScalarResult();
|
||||
$data = array_map('current', $data);
|
||||
$this->count = array_sum($data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user