Enhancement to paginator

No point in finding the count (via model) if the returned result count
is less than our limit. We then know that the count is the count of our
results
This commit is contained in:
Toby Cox 2014-04-16 18:28:55 +01:00 committed by mark_story
parent 89cd114e6f
commit 296ea215b1

View file

@ -202,6 +202,8 @@ class PaginatorComponent extends Component {
$count = 0;
} elseif ($object->hasMethod('paginateCount')) {
$count = $object->paginateCount($conditions, $recursive, $extra);
} elseif (count($results)<$limit) {
$count = count($results); // no point in finding the count if it's less than our limit
} else {
$parameters = compact('conditions');
if ($recursive != $object->recursive) {