Paginator\Adapter\QueryBuilder

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