Class Phalcon\Paginator\Adapter\NativeArray

implements Phalcon\Paginator\AdapterInterface

Pagination using a PHP array as source of data

  1. <?php
  2. $paginator = new \Phalcon\Paginator\Adapter\Model(
  3. array(
  4. "data" => array(
  5. array('id' => 1, 'name' => 'Artichoke'),
  6. array('id' => 2, 'name' => 'Carrots'),
  7. array('id' => 3, 'name' => 'Beet'),
  8. array('id' => 4, 'name' => 'Lettuce'),
  9. array('id' => 5, 'name' => '')
  10. ),
  11. "limit" => 2,
  12. "page" => $currentPage
  13. )
  14. );

Methods

public __construct (unknown $config)

Phalcon\Paginator\Adapter\NativeArray constructor

public setCurrentPage (unknown $page)

Set the current page number

public setLimit (unknown $limitRows)

Set current rows limit

public getLimit ()

Get current rows limit

public getPaginate ()

Returns a slice of the resultset to show in the pagination