10.04.2018 Views

Doctrine_manual-1-2-en

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 26: Utilities 342<br />

$pager->getPage();<br />

// Defines a new curr<strong>en</strong>t page (need to call execute again to adjust<br />

offsets and values)<br />

$pager->setPage($page);<br />

// Return the next page<br />

$pager->getNextPage();<br />

// Return the previous page<br />

$pager->getPreviousPage();<br />

// Return the first indice of curr<strong>en</strong>t page<br />

$pager->getFirstIndice();<br />

// Return the last indice of curr<strong>en</strong>t page<br />

$pager->getLastIndice();<br />

// Return true if it's necessary to paginate or false if not<br />

$pager->haveToPaginate();<br />

// Return the maximum number of records per page<br />

$pager->getMaxPerPage();<br />

// Defined a new maximum number of records per page (need to call execute<br />

again to adjust offset and values)<br />

$pager->setMaxPerPage($maxPerPage);<br />

// Returns the number of it<strong>en</strong>s in curr<strong>en</strong>t page<br />

$pager->getResultsInPage();<br />

// Returns the <strong>Doctrine</strong>_Query object that is used to make the count<br />

results to pager<br />

$pager->getCountQuery();<br />

// Defines the counter query to be used by pager<br />

$pager->setCountQuery($query, $params = null);<br />

// Returns the params to be used by counter <strong>Doctrine</strong>_Query (return<br />

$defaultParams if no param is defined)<br />

$pager->getCountQueryParams($defaultParams = array());<br />

// Defines the params to be used by counter <strong>Doctrine</strong>_Query<br />

$pager->setCountQueryParams($params = array(), $app<strong>en</strong>d = false);<br />

// Return the <strong>Doctrine</strong>_Query object<br />

$pager->getQuery();<br />

// Return an associated <strong>Doctrine</strong>_Pager_Range_* instance<br />

$pager->getRange($rangeStyle, $options = array());<br />

Controlling Range Styles<br />

There are some cases where simple paginations are not <strong>en</strong>ough. One example situation is<br />

wh<strong>en</strong> you want to write page links listings. To <strong>en</strong>able a more powerful control over pager,<br />

there is a small subset of pager package that allows you to create ranges.<br />

----------------- Brought to you by

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!