class Doctrine_Pager (View source)

Doctrine_Pager

Properties

protected Doctrine_Query $_query
protected Doctrine_Query $_countQuery
protected array $_countQueryParams
protected integer $_numResults
protected integer $_maxPerPage
protected integer $_page
protected integer $_lastPage
protected boolean $_executed

Methods

void
__construct(mixed $query, int $page, int $maxPerPage = 0)

__construct

void
_initialize($params = array())

_initialize

void
_adjustOffset()

_adjustOffset

boolen
getExecuted()

getExecuted

void
_setExecuted($executed)

_setExecuted

getRange(string $rangeStyle, array $options = array())

getRange

int
getNumResults()

getNumResults

void
_setNumResults($nb)

_setNumResults

int
getFirstPage()

getFirstPage

int
getLastPage()

getLastPage

void
_setLastPage($page)

_setLastPage

int
getPage()

getLastPage

int
getNextPage()

getNextPage

int
getPreviousPage()

getPreviousPage

int
getFirstIndice()

getFirstIndice

int
getLastIndice()

getLastIndice

bool
haveToPaginate()

haveToPaginate

void
setPage($page)

setPage

void
_setPage($page)

_setPage

int
getMaxPerPage()

getLastPage

void
setMaxPerPage($max)

setMaxPerPage

int
getResultsInPage()

getResultsInPage

void
_setQuery(Doctrine_Query $query)

_setQuery

getCountQuery()

getCountQuery

void
setCountQuery(Doctrine_Query $query, array $params = null)

setCountQuery

array
getCountQueryParams($defaultParams = array())

getCountQueryParams

void
setCountQueryParams(array $params = array(), boolean $append = false)

setCountQueryParams

execute($params = array(), $hydrationMode = null)

execute

Details

void __construct(mixed $query, int $page, int $maxPerPage = 0)

__construct

Parameters

mixed $query Accepts either a Doctrine_Query object or a string (which does the Doctrine_Query class creation).
int $page Current page
int $maxPerPage Maximum itens per page

Return Value

void

protected void _initialize($params = array())

_initialize

Initialize Pager object calculating number of results

Parameters

$params Optional parameters to Doctrine_Query::execute

Return Value

void

protected void _adjustOffset()

_adjustOffset

Adjusts last page of Doctrine_Pager, offset and limit of Doctrine_Query associated

Return Value

void

boolen getExecuted()

getExecuted

Returns the check if Pager was already executed at least once

Return Value

boolen Pager was executed

protected void _setExecuted($executed)

_setExecuted

Defines if Pager was already executed

Parameters

$executed Pager was executed

Return Value

void

Doctrine_Pager_Range getRange(string $rangeStyle, array $options = array())

getRange

Builds and return a Doctrine_Pager_Range_* based on arguments

Parameters

string $rangeStyle Pager Range style
array $options Custom subclass implementation options. Default is a blank array

Return Value

Doctrine_Pager_Range Pager Range

int getNumResults()

getNumResults

Returns the number of results found

Return Value

int the number of results found

protected void _setNumResults($nb)

_setNumResults

Defines the number of total results on initial query

Parameters

$nb Number of results found on initial query fetch

Return Value

void

int getFirstPage()

getFirstPage

Returns the first page

Return Value

int first page

int getLastPage()

getLastPage

Returns the last page (total of pages)

Return Value

int last page (total of pages)

protected void _setLastPage($page)

_setLastPage

Defines the last page (total of pages)

Parameters

$page last page (total of pages)

Return Value

void

int getPage()

getLastPage

Returns the current page

Return Value

int current page

int getNextPage()

getNextPage

Returns the next page

Return Value

int next page

int getPreviousPage()

getPreviousPage

Returns the previous page

Return Value

int previous page

int getFirstIndice()

getFirstIndice

Return the first indice number for the current page

Return Value

int First indice number

int getLastIndice()

getLastIndice

Return the last indice number for the current page

Return Value

int Last indice number

bool haveToPaginate()

haveToPaginate

Return true if it's necessary to paginate or false if not

Return Value

bool true if it is necessary to paginate, false otherwise

void setPage($page)

setPage

Defines the current page and automatically adjust offset and limits

Parameters

$page current page

Return Value

void

protected void _setPage($page)

_setPage

Defines the current page

Parameters

$page current page

Return Value

void

int getMaxPerPage()

getLastPage

Returns the maximum number of itens per page

Return Value

int maximum number of itens per page

void setMaxPerPage($max)

setMaxPerPage

Defines the maximum number of itens per page and automatically adjust offset and limits

Parameters

$max maximum number of itens per page

Return Value

void

int getResultsInPage()

getResultsInPage

Returns the number of itens in current page

Return Value

int Number of itens in current page

Doctrine_Query getQuery()

getQuery

Returns the Doctrine_Query collector object related to the pager

Return Value

Doctrine_Query Doctrine_Query object related to the pager

protected void _setQuery(Doctrine_Query $query)

_setQuery

Defines the collector query to be used by pager

Parameters

Doctrine_Query $query Accepts either a Doctrine_Query object or a string (which does the Doctrine_Query class creation).

Return Value

void

Doctrine_Query getCountQuery()

getCountQuery

Returns the Doctrine_Query object that is used to make the count results to pager

Return Value

Doctrine_Query Doctrine_Query object related to the pager

void setCountQuery(Doctrine_Query $query, array $params = null)

setCountQuery

Defines the counter query to be used by pager

Parameters

Doctrine_Query $query Accepts either a Doctrine_Query object or a string (which does the Doctrine_Query class creation).
array $params Optional params to be used by counter Doctrine_Query. If not defined, the params passed to execute method will be used.

Return Value

void

array getCountQueryParams($defaultParams = array())

getCountQueryParams

Returns the params to be used by counter Doctrine_Query

Parameters

$defaultParams

Return Value

array Doctrine_Query counter params

void setCountQueryParams(array $params = array(), boolean $append = false)

setCountQueryParams

Defines the params to be used by counter Doctrine_Query

Parameters

array $params Optional params to be used by counter Doctrine_Query. If not defined, the params passed to execute method will be used.
boolean $append Optional argument that append the query param instead of overriding the existent ones.

Return Value

void

Doctrine_Collection execute($params = array(), $hydrationMode = null)

execute

Executes the query, populates the collection and then return it

Parameters

$params Optional parameters to Doctrine_Query::execute
$hydrationMode Hydration Mode of Doctrine_Query::execute returned ResultSet.

Return Value

Doctrine_Collection The root collection