W3cubDocs

/Phalcon 2

Class Phalcon\Paginator\Adapter\QueryBuilder

implements Phalcon\Paginator\AdapterInterface

Pagination using a PHQL query builder as source of data

$builder = $this->modelsManager->createBuilder()
                   ->columns('id, name')
                   ->from('Robots')
                   ->orderBy('name');

  $paginator = new Phalcon\Paginator\Adapter\QueryBuilder(array(
      "builder" => $builder,
      "limit"=> 20,
      "page" => 1
  ));

Methods

public __construct (array $config)

public stdClass getPaginate ()

Returns a slice of the resultset to show in the pagination

public Phalcon\Paginator\Adapter\QueryBuilder $this Fluent interface setLimit (int $limit)

Set current rows limit

public int $limit getLimit ()

Get current rows limit

public setCurrentPage (int $page)

Set current page number

public getCurrentPage ()

Get current page number

public Phalcon\Paginator\Adapter\QueryBuilder $this Fluent interface setQueryBuilder (unknown $queryBuilder)

Set query builder object

public Phalcon\Mvc\Model\Query\BuilderInterface $builder getQueryBuilder ()

Get query builder object

© 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_QueryBuilder.html