Overwrite query limits only if set in QueryBuilder::addCriteria()
This commit is contained in:
parent
148789600a
commit
d3ab948d88
@ -1024,7 +1024,7 @@ class QueryBuilder
|
|||||||
* Add criteria to query.
|
* Add criteria to query.
|
||||||
* Add where expressions with AND operator.
|
* Add where expressions with AND operator.
|
||||||
* Add orderings.
|
* Add orderings.
|
||||||
* Override firstResult and maxResults.
|
* Override firstResult and maxResults if they set.
|
||||||
*
|
*
|
||||||
* @param Criteria $criteria
|
* @param Criteria $criteria
|
||||||
* @return QueryBuilder
|
* @return QueryBuilder
|
||||||
@ -1046,8 +1046,13 @@ class QueryBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->setFirstResult($criteria->getFirstResult());
|
// Overwrite limits only if they was set in criteria
|
||||||
$this->setMaxResults($criteria->getMaxResults());
|
if (($firstResult = $criteria->getFirstResult()) !== null) {
|
||||||
|
$this->setFirstResult($firstResult);
|
||||||
|
}
|
||||||
|
if (($maxResults = $criteria->getMaxResults()) !== null) {
|
||||||
|
$this->setMaxResults($maxResults);
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user