Table Of Contents

Previous topic

< Class Phalcon\Paginator\Adapter\NativeArray

Next topic

Class Phalcon\Paginator\Exception >

Class Phalcon\Paginator\Adapter\QueryBuilder

implements Phalcon\Paginator\AdapterInterface

Pagination using a PHQL query builder as source of data

<?php

  $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