title: Pagination in CakePHP 3.0
body: <p>I have been playing with the developer preview version of CakePHP 3.0 and I'm stuck trying to get the new ORM working with pagination.</p>
  
  <p>In my PostsController.php I have:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Controller;
  
  use App\Controller\AppController;
  
  class PostsController extends AppController {
  
      public $name = 'Posts';
  
      public $uses = 'Posts';
  
      public $components = ['Paginator'];
  
      public $paginate = [
          'fields' =&gt; ['Posts.id'],
          'limit' =&gt; 1,
          'order' =&gt; [
              'Post.id' =&gt; 'asc'
          ]
      ];
  
      public function index() {
  
          $posts = $this-&gt;paginate('Posts');
  
          $this-&gt;set('posts', $posts);
  
  
      }
  
  }
  </code></pre>
  
  <p>However the paging is working but the data doesn't come back. Apparently this because the data isn't directly returned in the new ORM but an object... Has anyone tried this yet? Knows how to fix the issue to get it working with the paginator?</p>
  
  <p>I've been reading the Migration Guide: <a href="http://book.cakephp.org/3.0/en/appendices/orm-migration.html" rel="nofollow">http://book.cakephp.org/3.0/en/appendices/orm-migration.html</a> but don't see anything about combining it with the paginator.</p>
  
  <p><strong>Note: I can't debug $posts and show it here because it's about 2000 lines of code containing all sorts of stuff about the ORM. Here's a taster...</strong></p>
  
  <pre><code>object(Cake\ORM\ResultSet) {
      [protected] _query =&gt; object(Cake\ORM\Query) {
          [protected] _table =&gt; object(Cake\ORM\Table) {
              [protected] _table =&gt; 'posts'
              [protected] _alias =&gt; 'Posts'
              [protected] _connection =&gt; object(Cake\Database\Connection) {
                  [protected] _config =&gt; array(
                      'password' =&gt; '*****',
                      'login' =&gt; '*****',
                      'host' =&gt; '*****',
                      'database' =&gt; '*****',
                      'prefix' =&gt; '*****',
                      'persistent' =&gt; false,
                      'encoding' =&gt; 'utf8',
                      'name' =&gt; 'default',
                      'datasource' =&gt; object(Cake\Database\Driver\Mysql) {
                          [protected] _baseConfig =&gt; array(
                              'password' =&gt; '*****',
                              'login' =&gt; '*****',
                              'host' =&gt; '*****',
                              'database' =&gt; '*****',
                              'port' =&gt; '*****',
                              'persistent' =&gt; true,
                              'flags' =&gt; array(),
                              'encoding' =&gt; 'utf8',
                              'timezone' =&gt; null,
                              'init' =&gt; array(),
                              'dsn' =&gt; null
                          )
                          [protected] _config =&gt; array(
                              'password' =&gt; '*****',
                              'login' =&gt; '*****',
                              'host' =&gt; '*****',
                              'database' =&gt; '*****',
                              'port' =&gt; '*****',
                              'prefix' =&gt; '*****',
                              'persistent' =&gt; false,
                              'encoding' =&gt; 'utf8',
                              'name' =&gt; 'default',
                              'flags' =&gt; array(),
                              'timezone' =&gt; null,
                              'init' =&gt; array(),
                              'dsn' =&gt; null
                          )
                          [protected] _autoQuoting =&gt; false...
  </code></pre>
  
  <p>So as you can see it's a huge object and presumably the data is somewhere within it.</p>