mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
89cd114e6f
commit
296ea215b1
1 changed files with 2 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue