Search code examples
cakephppaginator

CakePHP pagination


I've got some wierd problem with Pagination, the code:

$this->Paginator->settings = array(
    'Visit' => array(
        'limit' => 10
    )
);
$visits = $this->Paginator->paginate('Visit');
echo count($visits);

And count give me: page 1 = 0, page 2 = 6, page 3 = 10, page 4 = 7, ... Why? I thought that paginator id doing something like:

SELECT * FROM visits LIMIT 10 OFFSET pageNumber

I've got 4 realtions with visits table, maybe this is an issue?


Solution

  • I found it. Someone was deleting from return some elements by afterFind function in AppModel class. I checked VisitModell class but didnt check upclass, damn... so stupid. So sorry for wasting your time.