Class Phalcon\Paginator\Adapter\NativeArray

extends abstract class Phalcon\Paginator\Adapter

implements Phalcon\Paginator\AdapterInterface

Source on GitHub

Pagination using a PHP array as source of data

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

Methods

public __construct (array $config)

Phalcon\Paginator\Adapter\NativeArray constructor

public getPaginate ()

Returns a slice of the resultset to show in the pagination

public setCurrentPage (mixed $page) inherited from Phalcon\Paginator\Adapter

Set the current page number

public setLimit (mixed $limitRows) inherited from Phalcon\Paginator\Adapter

Set current rows limit

public getLimit () inherited from Phalcon\Paginator\Adapter

Get current rows limit