Sections

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

<?php

use Phalcon\Paginator\Adapter\NativeArray;

$paginator = new NativeArray(
    [
        "data"  => [
            ["id" => 1, "name" => "Artichoke"],
            ["id" => 2, "name" => "Carrots"],
            ["id" => 3, "name" => "Beet"],
            ["id" => 4, "name" => "Lettuce"],
            ["id" => 5, "name" => ""],
        ],
        "limit" => 2,
        "page"  => $currentPage,
    ]
);

Metody

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