W3cubDocs

/Phalcon 2

Class Phalcon\Paginator\Adapter\NativeArray

implements Phalcon\Paginator\AdapterInterface

Pagination using a PHP array as source of data

$paginator = new \Phalcon\Paginator\Adapter\Model(
    array(
            "data"  => array(
                    array('id' => 1, 'name' => 'Artichoke'),
                    array('id' => 2, 'name' => 'Carrots'),
                    array('id' => 3, 'name' => 'Beet'),
                    array('id' => 4, 'name' => 'Lettuce'),
                    array('id' => 5, 'name' => '')
            ),
            "limit" => 2,
            "page"  => $currentPage
    )
);

Methods

public __construct (array $config)

Phalcon\Paginator\Adapter\NativeArray constructor

public setCurrentPage (int $page)

Set the current page number

public stdClass getPaginate ()

Returns a slice of the resultset to show in the pagination

© 2011–2016 Phalcon Framework Team
Licensed under the Creative Commons Attribution License 3.0.
https://docs.phalconphp.com/en/2.0.0/api/Phalcon_Paginator_Adapter_NativeArray.html