title: CakePHP 2.x containable + pagination for nested model
body: <p>I have a problem with nested model pagination using containable in Cake...</p>
  
  <p>I've got three models: Category, CompanyCategory, Company and there association is like this</p>
  
  <pre><code>Category hasMany CompanyCategory
  CompanyCategory belongsTo Category 
  CompanyCategory belongsTo Company
  Company hasMany CompanyCategory
  </code></pre>
  
  <p>I get data using contain, as shown below:</p>
  
  <pre><code>$options = [
    'conditions' =&gt; ['Category.slug' =&gt; $slug],
    'contain' =&gt; [
      'CompanyCategory.Company.CompanyAddress'
    ]
  ];
  return $this-&gt;find('first', $options);
  </code></pre>
  
  <p>Everything works properly, until I wanted to paginate the nested model - Company. I use CategoriesController with show method, which renders the view with the selected category and associated companies (Company hasMany Categories and Category hasMany Companies).</p>
  
  <p>I've tried something like this:</p>
  
  <pre><code>$this-&gt;Paginator-&gt;settings = [
    'limit' =&gt; 1,
    'order' =&gt; [
      'id' =&gt; 'asc'
    ],
    'contain' =&gt; array('CompanyCategory.Company')
  ];
  $data = $this-&gt;Paginator-&gt;paginate('Category.CompanyCategory.Company', array('Category.slug LIKE' =&gt; $slug));
  $this-&gt;set('category', $data);
  </code></pre>
  
  <p>But this didn't work for me :(</p>
  
  <p>Any suggestions / help?</p>