LoginSignup
18
21

More than 5 years have passed since last update.

Cakephp で paginate での 外部結合を行う

Last updated at Posted at 2014-07-24

メモ

<?php
public class UsersController extends AppController {
public $paginate = array (
    'User' => array (
        'limit' => 20,
        'order' => 'User.id',
        'fields' => '*',
        'joins' => array (
            array (
                'type' => 'LEFT',
                'table' => 'roles',
                'alias' => 'Role',
                'conditions' => 'Role.id = User.role_id' 
            ) 
        ) 
    ), 
    "Role" => array() 
);

public function index($type = "all") {
    $this->request->list = $this->paginate ("User");
}

}
18
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
21