title: Can't use paginate on a query result
body: <p>According to the doc <a href="http://book.cakephp.org/3.0/en/controllers/components/pagination.html" rel="nofollow noreferrer">http://book.cakephp.org/3.0/en/controllers/components/pagination.html</a>, I'd like to paginate a result of a query like below:    </p>
  
  <pre><code>$unlocked_sitesQuery = $this-&gt;Deviceconnections
      -&gt;find()
      -&gt;contain([
          'Agthemes.Sites',
          'Agthemes.Agpois',
          'Agthemes.Agthemelanguages'
      ])
      -&gt;where(['request' =&gt; 'unlock'])
      -&gt;groupBy('agtheme.site.id');
  
  $unlocked_sites = $this-&gt;paginate($unlocked_sitesQuery);
  </code></pre>
  
  <p>But I get the following error:        </p>
  
  <blockquote>
    <p>Error: Call to undefined method <code>ArrayIterator::alias()</code> 
    File /home/mywebsite/vendor/cakephp/cakephp/src/Controller/Component/PaginatorComponent.php<br>
    Line: 154 </p>
  </blockquote>
  
  <p>What does it mean?</p>
  
  <p><strong>EDIT</strong>
  It seems that @ndm is right but the doc says:</p>
  
  <blockquote>
    <p>By default the <code>paginate()</code> method will use the default model for a     controller. You can also pass the resulting query of a find method:  </p>
  </blockquote>
  
  <pre><code>public function index() 
  {
      $query = $this-&gt;Articles-&gt;find('popular')-&gt;where(['author_id' =&gt; 1]); 
      $this-&gt;set('articles', $this-&gt;paginate($query));
  }
  </code></pre>
  
  <p>So it should work on a result set. Or I didn't understand what the doc explains. Possible.</p>