Paginate results filtered by condition on associated model (HABTM) using Containable
问题 I need to paginate list of Product s belonging to specific Category (HABTM association). In my Product model I have var $actsAs = array('Containable'); var $hasAndBelongsToMany = array( 'Category' => array( 'joinTable' => 'products_categories' ) ); And in ProductsController $this->paginate = array( 'limit' => 20, 'order' => array('Product.name' => 'ASC'), 'contain' => array( 'Category' => array( 'conditions' => array( 'Category.id' => 3 ) ) ) ); $this->set('products', $this->paginate());