From The Blog

CakePHP joining tables

28 December 2012, in CakePHP

In many cases when we want to formulate complex queries, that need joins between tables, we can still add joins on the fly by adding it to the call of find

$students_of_grade = $this->User->find('list',array(

                                 'table' => 'user_data',
                                 'alias' => 'UserData',
                                 'type' => 'inner',
                                 'foreignKey' => 'user_id',
                                 'conditions'=> array('UserData.user_id ='),


it also works for paginated results

Post a Comment