Class PaginatedResultSet
Paginated result set.
Namespace: Cake\Datasource\Paging
Property Summary
-
$results protected
Traversable<TKey, TValue>Resultset instance.
Method Summary
-
__construct() public
Constructor
-
count() public
-
currentPage() public
Get current page number.
-
getIterator() public
Get inner iterator
-
hasNextPage() public
Get whether there's a next page.
-
hasPrevPage() public
Get whether there's a previous page.
-
items() public
Get paginated items.
-
jsonSerialize() public
Provide data which should be serialized to JSON.
-
pageCount() public
Get total page count.
-
pagingParam() public
Get paging param.
-
pagingParams() public
Get all paging params.
-
perPage() public
Get items per page.
-
toArray() public
Get the paginated items as an array.
This will exhaust the iterator
items. -
totalCount() public
Get Total items counts.
Method Detail
__construct() ¶ public
__construct(iterable<TKey, TValue> $results, array $params)
Constructor
Parameters
-
iterable<TKey, TValue>$results Resultset instance.
-
array$params Paging params.
getIterator() ¶ public
getIterator(): Traversable<TKey, TValue>
Get inner iterator
Returns
Traversable<TKey, TValue>items() ¶ public
items(): Traversable<TKey, TValue>
Get paginated items.
Returns
Traversable<TKey, TValue>The paginated items result set.
jsonSerialize() ¶ public
jsonSerialize(): array
Provide data which should be serialized to JSON.
Returns
arraypagingParam() ¶ public
pagingParam(string $name): mixed
Get paging param.
Parameters
-
string$name
Returns
mixedpagingParams() ¶ public
pagingParams(): array<string, mixed>
Get all paging params.
Returns
array<string, mixed>toArray() ¶ public
toArray(): array<array-key, TValue>
Get the paginated items as an array.
This will exhaust the iterator items.
Returns
array<array-key, TValue>