title: CakePHP Pagination of associated HABTM model in Model View Controller
body: <p>I have two models - products and categories
  Category model HABTM Product</p>
  
  <p>When I create a View controller to view a single category, my recursive is set to 1 so I can load products in that category. Which is simple, works fine. </p>
  
  <p>But, how can I paginate and/or sort ONLY the products within the category. I've tried three or four different approaches but none leaves me with what I would expect - paginated products I can pass to the view to create a grid of sorted/paginated products. </p>
  
  <p>Here is the controller, all standard stuff:</p>
  
  <pre><code>//CATEGORY CONTROLLER
  public function view($id = null) {
  
  
      $category = $this-&gt;Category-&gt;find('first', array(
          'recursive' =&gt; 1,
          'conditions' =&gt; array('Category.id' =&gt; $id)
      ));
  
      if (empty($category)) {
          $this-&gt;redirect(array('action' =&gt; 'index'), 301);
          $this-&gt;Session-&gt;setFlash('The category could not be found.');
      }
      $this-&gt;set(compact('category'));
  
      // paginate products and make them available to view -- ???
  
  
  
  }
  </code></pre>
  
  <p>Anyone?</p>