CoolCMS API

ApiClientMapper extends ApiMapper
in package

FinalYes

External Api clients for the admin. The DataGrid list ({@see findAll()}) builds entities from the `get-all` overview. The Api has no generic `getAll` with filters and there are only a few clients, so ordering and paging happen here in memory.

Tags
extends

Table of Contents

Constants

SORTABLE  : array<string|int, mixed> = ['name' => 'name', 'createdAt' => 'createdAt',...
Columns the list can be ordered by (entity property to Api row key).

Properties

$hydrator  : EntityHydrator
$repository  : ApiClientRepository

Methods

__construct()  : mixed
create()  : Result
delete()  : Result
deleteAll()  : Result
deleteKey()  : Result
find()  : T|null
findAll()  : ApiClient>, 1: int}
DataGrid data source. Filters are not used (the grid has none); ordering is by one column.
findBy()  : T|null
getClient()  : array<string, mixed>|null
getOverview()  : array{clients: list>, defaultLimits: array}|null
getRoleOptions()  : array<int, array<string, mixed>>
issueKey()  : Result
revoke()  : Result
revokeKey()  : Result
save()  : Result
setEnabled()  : Result
toEntity()  : ApiClient
Maps an Api row to a list entity. The row contains neither the key nor its digest (the Api does not send them).
update()  : Result
updateColumns()  : Result
updateKey()  : Result
getEntityClass()  : T>
date()  : DateTime|null

Constants

SORTABLE

Columns the list can be ordered by (entity property to Api row key).

private array<string|int, mixed> SORTABLE = ['name' => 'name', 'createdAt' => 'createdAt', 'lastUsedAt' => 'lastUsedAt']

Properties

Methods

delete()

public delete(int|array<string|int, mixed> $id) : Result
Parameters
$id : int|array<string|int, mixed>
Return values
Result

deleteAll()

public deleteAll([array<string|int, mixed> $filters = [] ]) : Result
Parameters
$filters : array<string|int, mixed> = []
Return values
Result

find()

public find(int $pageId[, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
$pageId : int
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T|null

findAll()

DataGrid data source. Filters are not used (the grid has none); ordering is by one column.

public findAll([array<string|int, mixed>|null $filters = [] ][, array<string|int, mixed>|null $orderBys = null ][, int|null $offset = null ][, int|null $limit = null ][, array<string|int, mixed>|null $columns = null ][, bool $computeTotalCount = false ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : ApiClient>, 1: int}
Parameters
$filters : array<string|int, mixed>|null = []
$orderBys : array<string|int, mixed>|null = null

property => true (asc) / false (desc)

$offset : int|null = null
$limit : int|null = null
$columns : array<string|int, mixed>|null = null
$computeTotalCount : bool = false
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
ApiClient>, 1: int}

findBy()

public findBy([array<string|int, mixed>|null $filters = [] ][, string|array<string|int, mixed> $includes = [] ][, bool|null $useCache = null ]) : T|null
Parameters
$filters : array<string|int, mixed>|null = []
$includes : string|array<string|int, mixed> = []
$useCache : bool|null = null
Return values
T|null

getClient()

public getClient(int $id) : array<string, mixed>|null
Parameters
$id : int
Return values
array<string, mixed>|null

getOverview()

public getOverview() : array{clients: list>, defaultLimits: array}|null
Return values
array{clients: list>, defaultLimits: array}|null

getRoleOptions()

public getRoleOptions() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>

issueKey()

public issueKey(int $id, string|null $label, string|null $expiresAt) : Result
Parameters
$id : int
$label : string|null
$expiresAt : string|null
Return values
Result

save()

public save(BaseEntity $entity[, array<string, mixed> $meta = [] ][, array<int, string> $skipFields = [] ]) : Result
Parameters
$entity : BaseEntity
$meta : array<string, mixed> = []
$skipFields : array<int, string> = []
Return values
Result

toEntity()

Maps an Api row to a list entity. The row contains neither the key nor its digest (the Api does not send them).

public static toEntity(array<string, mixed> $row) : ApiClient
Parameters
$row : array<string, mixed>
Return values
ApiClient

update()

public update(int $id, array<string, mixed> $values) : Result
Parameters
$id : int
$values : array<string, mixed>
Return values
Result

updateColumns()

public updateColumns(array<string|int, mixed> $ids, array<string, mixed> $values) : Result
Parameters
$ids : array<string|int, mixed>

ids or composite-id arrays

$values : array<string, mixed>

property name => new value

Return values
Result

updateKey()

public updateKey(int $id, int $keyId, string|null $label, string|null $expiresAt) : Result
Parameters
$id : int
$keyId : int
$label : string|null
$expiresAt : string|null
Return values
Result

date()

private static date(mixed $value) : DateTime|null
Parameters
$value : mixed
Return values
DateTime|null
On this page

Search results