Cakephp 3.x Sorting of another model is not working
I have two models Users & Roles Here "Roles hasMany Users" and "Users belongsTo Roles" When the user saved we're also asking user's role & record saved. Problem : I have list of users with column firstname, lastname,roles. Each & Every column has sorting but on roles sorting is not working. Role Table contains "name" field for Role name. I have referred below link but it doesn't working for me. Pagination Sort in Cakephp 3.x UsersController: public function index() { $this->paginate = [ 'contain' => ['Roles'], 'conditions' => [ 'Users.user_type <>' => 1 ] ]; $this->set('users', $this->paginate