KMP PHP API Reference

ActionItemsTable extends BaseTable
in package

ActionItems Table - reusable, polymorphic "to-do" / check records.

Table of Contents

Constants

CACHE_GROUPS_TO_CLEAR  : array<string|int, string> = []
CACHES_TO_CLEAR  : array<string|int, array{string, string}> = []
ID_CACHES_TO_CLEAR  : array<string|int, array{string, string}> = []

Properties

$ActionItemLogs  : ActionItemLogsTable|HasMany
$Branches  : BranchesTable|BelongsTo
$CompletedByMembers  : MembersTable|BelongsTo

Methods

addBranchScopeQuery()  : SelectQuery
Add branch-based data scoping to a query.
afterDelete()  : void
After delete hook to capture impersonation audit trail entries.
afterSave()  : void
After-save handler for automatic cache invalidation.
beforeSave()  : void
Populate denormalized assignee lookup fields from the assignment snapshot.
findForEntity()  : SelectQuery
Scope a query to a polymorphic owner.
findOpen()  : SelectQuery
Scope a query to open items only.
get()  : ActionItem
getOpenTaskCountForMember()  : int
Count open to-do items the given member is eligible to act on.
initialize()  : void
Initialize table associations and behaviors.
newEmptyEntity()  : ActionItem
newEntity()  : ActionItem
patchEntity()  : ActionItem
saveOrFail()  : ActionItem
validationDefault()  : Validator
Default validation rules.
logImpersonationAction()  : void
Record impersonated writes to audit log table.
setJsonColumnTypesIfPresent()  : void
Mark JSON columns when the table schema is available.
assigneeLookupFromConfig()  : array<string, mixed>
positiveIntOrNull()  : int|null
resolvePermissionLookup()  : array{0: int|null, 1: string|null}
resolveRoleLookup()  : array{0: int|null, 1: string|null}
stringOrNull()  : string|null

Constants

CACHE_GROUPS_TO_CLEAR

protected array<string|int, string> CACHE_GROUPS_TO_CLEAR = []

Cache groups to clear entirely on save

CACHES_TO_CLEAR

protected array<string|int, array{string, string}> CACHES_TO_CLEAR = []

Static cache entries to clear on save

ID_CACHES_TO_CLEAR

protected array<string|int, array{string, string}> ID_CACHES_TO_CLEAR = []

Entity-ID cache prefixes to clear on save

Properties

Methods

addBranchScopeQuery()

Add branch-based data scoping to a query.

public addBranchScopeQuery(SelectQuery $query, array<string|int, int> $branchIDs) : SelectQuery

Child tables should override for custom branch relationships.

Parameters
$query : SelectQuery

The query to modify

$branchIDs : array<string|int, int>

Authorized branch IDs

Return values
SelectQuery

Query with branch filtering

afterDelete()

After delete hook to capture impersonation audit trail entries.

public afterDelete(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
$event : EventInterface

Delete event

$entity : EntityInterface

Entity being deleted

$options : ArrayObject

Delete options

afterSave()

After-save handler for automatic cache invalidation.

public afterSave(EventInterface $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
$event : EventInterface

The afterSave event

$entity : EntityInterface

The saved entity

$options : ArrayObject

Save options

beforeSave()

Populate denormalized assignee lookup fields from the assignment snapshot.

public beforeSave(Event $event, EntityInterface $entity, ArrayObject $options) : void
Parameters
$event : Event

The beforeSave event.

$entity : EntityInterface

Action item entity.

$options : ArrayObject

Save options.

findForEntity()

Scope a query to a polymorphic owner.

public findForEntity(SelectQuery $query, string $entityType, int $entityId) : SelectQuery
Parameters
$query : SelectQuery

The query to scope

$entityType : string

Owner type, e.g. Awards.Bestowals

$entityId : int

Owner primary key

Return values
SelectQuery

findOpen()

Scope a query to open items only.

public findOpen(SelectQuery $query) : SelectQuery
Parameters
$query : SelectQuery

The query to scope

Return values
SelectQuery

get()

public get(mixed $primaryKey[, array<string|int, mixed>|string $finder = = '\'all\'' ][, CacheInterface|string|null $cache = = 'null' ][, Closure|string|null $cacheKey = = 'null' ], mixed ...$args) : ActionItem
Parameters
$primaryKey : mixed
$finder : array<string|int, mixed>|string = = '\'all\''
$cache : CacheInterface|string|null = = 'null'
$cacheKey : Closure|string|null = = 'null'
$args : mixed
Return values
ActionItem

getOpenTaskCountForMember()

Count open to-do items the given member is eligible to act on.

public static getOpenTaskCountForMember(int $memberId) : int

Powers the "My To-Dos" navigation badge using the same eligibility resolution that populates the My To-Dos queue.

Parameters
$memberId : int

The member id

Return values
int

initialize()

Initialize table associations and behaviors.

public initialize(array<string, mixed> $config) : void
Parameters
$config : array<string, mixed>

Table configuration

newEntity()

public newEntity(array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : ActionItem
Parameters
$data : array<string|int, mixed>
$options : array<string|int, mixed> = = '[]'
Return values
ActionItem

patchEntity()

public patchEntity(EntityInterface $entity, array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : ActionItem
Parameters
$entity : EntityInterface
$data : array<string|int, mixed>
$options : array<string|int, mixed> = = '[]'
Return values
ActionItem

saveOrFail()

public saveOrFail(EntityInterface $entity[, array<string|int, mixed> $options = = '[]' ]) : ActionItem
Parameters
$entity : EntityInterface
$options : array<string|int, mixed> = = '[]'
Return values
ActionItem

validationDefault()

Default validation rules.

public validationDefault(Validator $validator) : Validator
Parameters
$validator : Validator

Validator

Return values
Validator

logImpersonationAction()

Record impersonated writes to audit log table.

protected logImpersonationAction(string $defaultOperation, EntityInterface $entity) : void
Parameters
$defaultOperation : string

Operation fallback (save/delete)

$entity : EntityInterface

Affected entity

setJsonColumnTypesIfPresent()

Mark JSON columns when the table schema is available.

protected setJsonColumnTypesIfPresent(array<int, string> $columns) : void

Some reset/migration flows instantiate table classes before every table exists. JSON type mapping is optional metadata, so skip it until the schema can be described instead of failing application bootstrap.

Parameters
$columns : array<int, string>

JSON column names.

assigneeLookupFromConfig()

private assigneeLookupFromConfig(string $assigneeType, array<string, mixed> $config, mixed $branchId) : array<string, mixed>
Parameters
$assigneeType : string

Assignee type.

$config : array<string, mixed>

Assignee config snapshot.

$branchId : mixed

Branch scope from the action item.

Return values
array<string, mixed>

positiveIntOrNull()

private static positiveIntOrNull(mixed $value) : int|null
Parameters
$value : mixed

Raw value.

Return values
int|null

resolvePermissionLookup()

private resolvePermissionLookup(int|null $permissionId, string|null $permissionName) : array{0: int|null, 1: string|null}
Parameters
$permissionId : int|null

Configured permission ID.

$permissionName : string|null

Configured permission name.

Return values
array{0: int|null, 1: string|null}

resolveRoleLookup()

private resolveRoleLookup(int|null $roleId, string|null $roleName) : array{0: int|null, 1: string|null}
Parameters
$roleId : int|null

Configured role ID.

$roleName : string|null

Configured role name.

Return values
array{0: int|null, 1: string|null}

stringOrNull()

private static stringOrNull(mixed $value) : string|null
Parameters
$value : mixed

Raw value.

Return values
string|null
On this page

Search results