I'm using cake php and I baked a database view in my project using cake bake model commission_items
. The commission_items is a MySQL view, to make selects simpler.
My problem is that when I use find() that data returned is not the same of the view. When I run select * from commission_items
in MySQL I get something like this:
user_id | item_id
------------------
20 | 400
And when I run the code below in cakephp, the result is messy.
$commissionTable = $this->loadModel( 'CommissionItems' );
$itemsToList = $commissionTable->find('all', array('limit'=>4, 'offset'=>3));
The result returns repeating some properties:
user_id | item_id
------------------
20 | 400
50 | 400
71 | 400
Would you have some tips for me to check? I've tried to clean \tmp\cache\models
folder and it didn't work.
By using sql query direct in database
select * from commission_items
In cakephp, you should use this once:
$commissionTable = $this->loadModel( 'CommissionItems' );
$itemsToList = $commissionTable->find('all');
Please remove offset and limit in cakephp parametter