內容目录

上一个主题

< Abstract class Phalcon\Paginator\Adapter

下一个主题

Class Phalcon\Paginator\Adapter\NativeArray >

Phalcon玩家群:150237524Phalcon玩家

Class Phalcon\Paginator\Adapter\Model

extends abstract class Phalcon\Paginator\Adapter

implements Phalcon\Paginator\AdapterInterface

Source on GitHub

This adapter allows to paginate data using a Phalcon\Mvc\Model resultset as a base.

<?php

use Phalcon\Paginator\Adapter\Model;

$paginator = new Model(
    [
        "data"  => Robots::find(),
        "limit" => 25,
        "page"  => $currentPage,
    ]
);

$paginate = $paginator->getPaginate();

Methods

public __construct (array $config)

Phalcon\Paginator\Adapter\Model 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