mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 23:49:55 +00:00
avoid paginate count when no results
This commit is contained in:
parent
7008b812be
commit
88240b2874
1 changed files with 3 additions and 1 deletions
|
@ -197,7 +197,9 @@ class PaginatorComponent extends Component {
|
||||||
$defaults = $this->getDefaults($object->alias);
|
$defaults = $this->getDefaults($object->alias);
|
||||||
unset($defaults[0]);
|
unset($defaults[0]);
|
||||||
|
|
||||||
if ($object->hasMethod('paginateCount')) {
|
if (!$results) {
|
||||||
|
$count = 0;
|
||||||
|
} elseif ($object->hasMethod('paginateCount')) {
|
||||||
$count = $object->paginateCount($conditions, $recursive, $extra);
|
$count = $object->paginateCount($conditions, $recursive, $extra);
|
||||||
} else {
|
} else {
|
||||||
$parameters = compact('conditions');
|
$parameters = compact('conditions');
|
||||||
|
|
Loading…
Add table
Reference in a new issue