title: CakePHP 3.x paginate associated model with relationship
body: <p>I have a model Categories wish is associated with Channels model (belongsToMany). 
  In view Category i have many Related Channels and i want paginate them. 
  Table Channels don't have category_id i used table category_channels for relations. </p>
  
  <p>If i use this code:</p>
  
  <pre><code> $category = $this-&gt;Categories-&gt;get($id, ['contain' =&gt; ['Users', 'Chanels']]);
  
   $this-&gt;paginate = [
            'contain' =&gt; ['Chanels', 'Users'],
            'sortWhitelist' =&gt; [
                'Chanels.title'
          ]
   ];
   $this-&gt;set('category', $this-&gt;paginate($category));    
  </code></pre>
  
  <p>I have error:
  Error: Call to undefined method App\Model\Entity\Category::alias() </p>
  
  <p>I have tried another code:</p>
  
  <pre><code>$query = $this-&gt;Categories-&gt;find('all')
              -&gt;where(['Categories.id' =&gt; $id])
              -&gt;contain(['Users', 'Chanels' =&gt; function($q) {
                      return $q
                          -&gt;order('created ASC')
                          -&gt;limit(5);
            }]);
  
  $category = $this-&gt;paginate($query);
  
  $this-&gt;set(compact('category'));
  $this-&gt;set('_serialize', ['category']);
  </code></pre>
  
  <p>It's work i have 5 channels in Related Channels but pagination doesn't work!
  How is possible to paginate Channels? 
  Thanks for any help!</p>