Skip to content

Commit

Permalink
avoid paginate count when no results
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Jan 10, 2013
1 parent 7008b81 commit 88240b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Cake/Controller/Component/PaginatorComponent.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -197,7 +197,9 @@ public function paginate($object = null, $scope = array(), $whitelist = array())
$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');
Expand Down

0 comments on commit 88240b2

Please sign in to comment.