Propel 2 API
Class

Propel\Runtime\Util\PropelModelPager

class PropelModelPager implements IteratorAggregate, Countable

Implements a pager based on a ModelCriteria The code from this class heavily borrows from symfony's sfPager class

Methods

__construct(ModelCriteria $query, $maxPerPage = 10)

setQuery(ModelCriteria $query)

getQuery()

init($con = null)

Collection getResults()

Get the collection of results in the page

getCurrentMaxLink()

getMaxRecordLimit()

setMaxRecordLimit($limit)

getLinks($nb_links = 5)

boolean haveToPaginate()

Test whether the number of results exceeds the max number of results per page

int getFirstIndex()

Get the index of the first element in the page Returns 1 on the first page, $maxPerPage +1 on the second page, etc

int getLastIndex()

Get the index of the last element in the page Always less than or equal to $maxPerPage

int getNbResults()

Get the total number of results of the query This can be greater than $maxPerPage

boolean isFirstPage()

Check whether the current page is the first page

int getFirstPage()

Get the number of the first page

boolean isLastPage()

Check whether the current page is the last page

int getLastPage()

Get the number of the last page

int getPage()

Get the number of the current page

setPage(int $page)

Set the number of the current page

int getNextPage()

Get the number of the next page

int getPreviousPage()

Get the number of the previous page

int getMaxPerPage()

Get the maximum number results per page

setMaxPerPage(int $max)

Set the maximum number results per page

boolean isFirst()

Check whether the internal pointer is at the beginning of the list

boolean isLast()

Check whether the internal pointer is at the end of the list

boolean isEmpty()

Check if the collection is empty

boolean isOdd()

Check if the current index is an odd integer

boolean isEven()

Check if the current index is an even integer

getIterator()

int count()

Returns the total number of results.

Details

at line 47
public __construct(ModelCriteria $query, $maxPerPage = 10)

Parameters

ModelCriteria $query
$maxPerPage

at line 61
public setQuery(ModelCriteria $query)

Parameters

ModelCriteria $query

at line 66
public getQuery()

at line 71
public init($con = null)

Parameters

$con

at line 117
public Collection getResults()

Get the collection of results in the page

Return Value

Collection A collection of results

at line 133
public getMaxRecordLimit()

at line 138
public setMaxRecordLimit($limit)

Parameters

$limit

Parameters

$nb_links

at line 166
public boolean haveToPaginate()

Test whether the number of results exceeds the max number of results per page

Return Value

boolean true if the pager displays only a subset of the results

at line 177
public int getFirstIndex()

Get the index of the first element in the page Returns 1 on the first page, $maxPerPage +1 on the second page, etc

Return Value

int

at line 192
public int getLastIndex()

Get the index of the last element in the page Always less than or equal to $maxPerPage

Return Value

int

at line 211
public int getNbResults()

Get the total number of results of the query This can be greater than $maxPerPage

Return Value

int

at line 231
public boolean isFirstPage()

Check whether the current page is the first page

Return Value

boolean true if the current page is the first page

at line 241
public int getFirstPage()

Get the number of the first page

Return Value

int Always 1

at line 251
public boolean isLastPage()

Check whether the current page is the last page

Return Value

boolean true if the current page is the last page

at line 261
public int getLastPage()

Get the number of the last page

Return Value

int

at line 284
public int getPage()

Get the number of the current page

Return Value

int

at line 294
public setPage(int $page)

Set the number of the current page

Parameters

int $page

at line 308
public int getNextPage()

Get the number of the next page

Return Value

int

at line 318
public int getPreviousPage()

Get the number of the previous page

Return Value

int

at line 328
public int getMaxPerPage()

Get the maximum number results per page

Return Value

int

at line 338
public setMaxPerPage(int $max)

Set the maximum number results per page

Parameters

int $max

at line 362
public boolean isFirst()

Check whether the internal pointer is at the beginning of the list

Return Value

boolean

See also

Collection

at line 373
public boolean isLast()

Check whether the internal pointer is at the end of the list

Return Value

boolean

See also

Collection

at line 384
public boolean isEmpty()

Check if the collection is empty

Return Value

boolean

See also

Collection

at line 395
public boolean isOdd()

Check if the current index is an odd integer

Return Value

boolean

See also

Collection

at line 406
public boolean isEven()

Check if the current index is an even integer

Return Value

boolean

See also

Collection

at line 411
public getIterator()

at line 422
public int count()

Returns the total number of results.

Return Value

int

See also

Countable