\Charcoal\Source\DatabaseDatabasePagination

The DatabasePagination makes a Pagination SQL-aware

Summary

Methods
Properties
Constants
setData()
setPage()
page()
setNumPerPage()
numPerPage()
first()
last()
sql()
No public properties found
DEFAULT_PAGE
DEFAULT_NUM_PER_PAGE
No protected methods found
$page
$numPerPage
N/A
No private methods found
No private properties found
N/A

Constants

DEFAULT_PAGE

DEFAULT_PAGE

DEFAULT_NUM_PER_PAGE

DEFAULT_NUM_PER_PAGE

Properties

$page

$page : integer

Type

integer

$numPerPage

$numPerPage : integer

Type

integer

Methods

setData()

setData(array  $data) : \Charcoal\Source\Pagination

Parameters

array $data

The pagination data (page, num_per_page).

Returns

\Charcoal\Source\Pagination

Chainable

setPage()

setPage(integer  $page) : \Charcoal\Source\Pagination

Parameters

integer $page

The current page. Start at 0.

Throws

\InvalidArgumentException

If the parameter is not numeric or < 0.

Returns

\Charcoal\Source\Pagination

(Chainable)

page()

page() : integer

Returns

integer

setNumPerPage()

setNumPerPage(integer  $num) : \Charcoal\Source\Pagination

Parameters

integer $num

The number of results to retrieve, per page.

Throws

\InvalidArgumentException

If the parameter is not numeric or < 0.

Returns

\Charcoal\Source\Pagination

(Chainable)

numPerPage()

numPerPage() : integer

Returns

integer

first()

first() : integer

Returns

integer

last()

last() : integer

Can be greater than the actual number of items in Storage

Returns

integer

sql()

sql() : string

Get the pagination's SQL string (Full "LIMIT" subquery)

For example, for the pagination {page:3,num_per_page:50} the result would be: ' LIMIT 100, 50'.

Returns

string