avoid paginate count when no results

This commit is contained in:
Ceeram 2013-01-10 16:39:07 +01:00
parent 7008b812be
commit 88240b2874

View file

@ -197,7 +197,9 @@ class PaginatorComponent extends Component {
$defaults = $this->getDefaults($object->alias);
unset($defaults[0]);
if ($object->hasMethod('paginateCount')) {
if (!$results) {
$count = 0;
} elseif ($object->hasMethod('paginateCount')) {
$count = $object->paginateCount($conditions, $recursive, $extra);
} else {
$parameters = compact('conditions');