Pionia Core

PaginationCore
in package

Table of Contents

Properties

$limit  : int
$offset  : int
$baseQuery  : Join|Builder|null
$db  : string|null
$parged  : array<string|int, mixed>
$reqData  : array<string|int, mixed>
$table  : string

Methods

__construct()  : mixed
columns()  : $this
Sets the columns to return in the query
init()  : PaginationCore
paginate()  : array<string|int, mixed>|null
Should be called finally to get the paginated data.
where()  : PaginationCore
extractPagination()  : array<string|int, mixed>
Picks the pagination data from the request. Pagination data can be defined in the `PAGINATION` key or the `pagination` key.

Properties

$parged

private array<string|int, mixed> $parged = ['columns' => '*', 'where' => []]

Methods

__construct()

public __construct(array<string|int, mixed>|null $reqData, string $table[, int|null $limit = 10 ][, int|null $offset = 0 ][, string|null $db = 'db' ]) : mixed
Parameters
$reqData : array<string|int, mixed>|null
$table : string
$limit : int|null = 10
$offset : int|null = 0
$db : string|null = 'db'

columns()

Sets the columns to return in the query

public columns([string|array<string|int, mixed> $columns = "*" ]) : $this
Parameters
$columns : string|array<string|int, mixed> = "*"
Return values
$this

paginate()

Should be called finally to get the paginated data.

public paginate([array<string|int, mixed>|null $where = null ][, array<string|int, mixed>|null $joins = null ]) : array<string|int, mixed>|null

Supports where clause just like the where method in the Porm query builder

Parameters
$where : array<string|int, mixed>|null = null
$joins : array<string|int, mixed>|null = null
Tags
throws
BaseDatabaseException
throws
Exception
Return values
array<string|int, mixed>|null

extractPagination()

Picks the pagination data from the request. Pagination data can be defined in the `PAGINATION` key or the `pagination` key.

private extractPagination() : array<string|int, mixed>

You can also define them in the SEARCH key or the search key.

Pagination usually is comprised of the limit and offset or LIMIT and OFFSET keys.

If none can't be found, it implies the request is new, so the default values are used.

Return values
array<string|int, mixed>

        
On this page

Search results