jagguy
asked on
pagination and joins
Hi, I can use paginate as follows.
I cant understand why you need to use joins in paginate if the models are related in cakephp? Doesnt the join happen automatically?
In what case would I need to define a join in a paginate for related models? You can even use the conditions clause (where) to specify what records to display in paginate. There need for a join statement has stumped me and the docs dont explain this
http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html
$this->paginate = array(
'limit' => 3,
'order' => array('Student.id' => 'ASC','Student.first_name' => 'ASC'),
'contain' => array('TutoringType','Refe rral')
);
$this->set('students', $this->paginate());
I cant understand why you need to use joins in paginate if the models are related in cakephp? Doesnt the join happen automatically?
In what case would I need to define a join in a paginate for related models? You can even use the conditions clause (where) to specify what records to display in paginate. There need for a join statement has stumped me and the docs dont explain this
http://book.cakephp.org/2.0/en/core-libraries/components/pagination.html
$this->paginate = array(
'limit' => 3,
'order' => array('Student.id' => 'ASC','Student.first_name'
'contain' => array('TutoringType','Refe
);
$this->set('students', $this->paginate());
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.