SettingMapper
extends ApiMapper
in package
FinalYes
Admin mapper that hydrates Api repository data into entities.
Tags
Table of Contents
Properties
- $hydrator : EntityHydrator
- $repository : SettingRepository
- $settings : array<int, array<string, mixed>>
Methods
- __construct() : mixed
- delete() : Result
- deleteAll() : Result
- find() : T|null
- findAll() : T>, 1: int}
- findBy() : T|null
- get() : mixed
- getAll() : array<int, array<string, mixed>>
- save() : Result
- saveBatch() : Result
- Passes through to the atomic Api operation. After success the local map is reloaded, so a later read in the same request does not return pre-save values.
- updateColumns() : Result
- getEntityClass() : T>
- initalizeEntity() : Setting|null
- initializeSettings() : void
- Takes the complete settings from the Api (neon + DB merged on the Api side), not from the entity `get-all`, which returns only DB rows and would miss the neon directories.
Properties
$hydrator read-only
protected
EntityHydrator
$hydrator
$repository read-only
protected
SettingRepository
$repository
$settings
private
array<int, array<string, mixed>>
$settings
= []
module => key => value (neon + DB from the Api)
Methods
__construct()
public
__construct(SettingRepository $repository, EntityHydrator $hydrator) : mixed
Parameters
- $repository : SettingRepository
- $hydrator : EntityHydrator
delete()
public
delete(int|array<string|int, mixed> $id) : Result
Parameters
- $id : int|array<string|int, mixed>
Return values
ResultdeleteAll()
public
deleteAll([array<string|int, mixed> $filters = [] ]) : Result
Parameters
- $filters : array<string|int, mixed> = []
Return values
Resultfind()
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|nullfindAll()
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 ]) : T>, 1: int}
Parameters
- $filters : array<string|int, mixed>|null = []
- $orderBys : array<string|int, mixed>|null = null
- $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
T>, 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|nullget()
public
get(int $moduleId, string $key) : mixed
Parameters
- $moduleId : int
- $key : string
getAll()
public
getAll() : array<int, array<string, mixed>>
Return values
array<int, array<string, mixed>>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
ResultsaveBatch()
Passes through to the atomic Api operation. After success the local map is reloaded, so a later read in the same request does not return pre-save values.
public
saveBatch(array<int, array{module: int, key: string, value: string}> $settings) : Result
Parameters
- $settings : array<int, array{module: int, key: string, value: string}>
Return values
ResultupdateColumns()
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
ResultgetEntityClass()
protected
getEntityClass() : T>
Return values
T>initalizeEntity()
protected
initalizeEntity(array<string, mixed> $row) : Setting|null
Parameters
- $row : array<string, mixed>
Return values
Setting|nullinitializeSettings()
Takes the complete settings from the Api (neon + DB merged on the Api side), not from the entity `get-all`, which returns only DB rows and would miss the neon directories.
private
initializeSettings() : void