mokiwaa
September 8, 2016, 7:57pm
1
This is my action:
public function index()
{
$this->paginate = [
‘page’ => 1,
‘limit’ => 12,
‘maxLimit’ => 12
];
$suppliers =$this->Suppliers->find(‘all’)
->order([‘Suppliers.description’=>‘asc’]);
$suppliers = $this->paginate($suppliers);
$this->set(compact(‘suppliers’));
$this->set(’_serialize’, [‘suppliers’]);
}
No matters value I put on limit, max limit… he always give me all record from my database…
aavrug
September 9, 2016, 3:47am
2
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.
mokiwaa
September 9, 2016, 10:20am
3
Thanks for your advice you are right…but can you help with my ‘limit’ problem?
aavrug
September 9, 2016, 10:25am
4
I am not seeing any issue with this syntax. This code should work.
mokiwaa
September 9, 2016, 10:36am
5
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.
mokiwaa
September 9, 2016, 10:40am
7
If I just want to show the last 20 result of the paginate? 2 page 10 record per page?
aavrug
September 9, 2016, 11:59am
8
@markstory Can you please guide us. This seems an issue with CakePHP-3. I also tried and seems the maxLimit option not working.
mokiwaa
September 9, 2016, 1:10pm
9
What do you mean with: “Can you please guide us.” What do you need to know?
aavrug
September 12, 2016, 8:34am
10
I raised an issue and asked to CakePHP members. You can see the discussion here https://github.com/cakephp/cakephp/issues/9446
mokiwaa
September 30, 2016, 12:03am
11
Many thanks for your help…