CoolCMS API

MenuItemService extends ApiService
in package
uses TreeTrait

Admin service that delegates reads to the mapper.

Tags
extends

Table of Contents

Properties

$mapper  : MenuItemMapper

Methods

__construct()  : mixed
delete()  : Result
deleteAll()  : Result
deleteTreeNode()  : Result
find()  : T|null
Finds one entity by id.
findAll()  : T>, 1: int}
Finds all entities matching the criteria.
findBy()  : T|null
Finds one entity by filters.
getTotalCount()  : int|null
insertTreeNode()  : Result
moveSubtree()  : Result
moveSubtreeTo()  : Result
moveTreeNode()  : Result
reorderChildren()  : Result
save()  : Result
updateColumns()  : Result

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()

Finds one entity by id.

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

findAll()

Finds all entities matching the criteria.

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()

Finds one entity by filters.

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

getTotalCount()

public getTotalCount() : int|null
Return values
int|null

moveSubtree()

public moveSubtree(int $id, int|null $newParentId, TreeConfig $config) : Result
Parameters
$id : int
$newParentId : int|null

null moves to the root level

$config : TreeConfig
Return values
Result

moveSubtreeTo()

public moveSubtreeTo(int $id, int|null $newParentId, int $afterId, TreeConfig $config[, TreeMoveExpectation|null $expectation = null ]) : Result
Parameters
$id : int
$newParentId : int|null

null is the root level

$afterId : int

-1 first child, 0 last child, >0 after that sibling

$config : TreeConfig
$expectation : TreeMoveExpectation|null = null

expected state of the move (null skips the check)

Return values
Result

reorderChildren()

public reorderChildren(int|null $parentId, array<int, int> $orderedIds, TreeConfig $config) : Result
Parameters
$parentId : int|null

null is the root level

$orderedIds : array<int, int>

child ids in the new order

$config : TreeConfig
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

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
On this page

Search results