How to limit number of result in pagination?

This is my action:

public function index()
$this->paginate = [
‘page’ => 1,
‘limit’ => 12,
‘maxLimit’ => 12
$suppliers =$this->Suppliers->find(‘all’)
$suppliers = $this->paginate($suppliers);
$this->set(’_serialize’, [‘suppliers’]);

No matters value I put on limit, max limit… he always give me all record from my database…

No need to write $suppliers =$this->Suppliers->find('all') ->order(['Suppliers.description'=>'asc']);.

The only code that you require after the paginate settings is
$suppliers = $this->paginate($this->Suppliers);

If you want additional conditions you can write it in the paginate settings array.

Thanks for your advice you are right…but can you help with my ‘limit’ problem?

I am not seeing any issue with this syntax. This code should work.

If I have 200 records in my database and if I set
$this->paginate = [ ‘page’ => 1, ‘limit’ => 10, ‘maxLimit’ => 10 ];
in my view I see 20 page with 10 record per page.

Yes this is the flow.

If I just want to show the last 20 result of the paginate? 2 page 10 record per page?

@markstory Can you please guide us. This seems an issue with CakePHP-3. I also tried and seems the maxLimit option not working.

What do you mean with: “Can you please guide us.” What do you need to know?

I raised an issue and asked to CakePHP members. You can see the discussion here

Many thanks for your help…