KMP PHP API Reference

QueueProcessesTable extends BaseTable
in package
uses LocatorAwareTrait

QueueProcesses Model

Tags
mixin

Table of Contents

Constants

CACHE_GROUPS_TO_CLEAR  = []
CACHES_TO_CLEAR  = []
ID_CACHES_TO_CLEAR  = []

Properties

$CurrentQueuedJobs  : QueuedJobsTable|HasOne

Methods

add()  : int
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.
buildServerString()  : string|null
Use ENV to control the server name of the servers run workers with.
cleanEndedProcesses()  : int
defaultConnectionName()  : string
Sets connection name
deleteMany()  : ResultSetInterface<string|int, QueueProcess>|false
deleteManyOrFail()  : ResultSetInterface<string|int, QueueProcess>
endProcess()  : void
Soft ending of a running job, e.g. when migration is starting
findActive()  : SelectQuery
findOrCreate()  : QueueProcess
get()  : QueueProcess
getProcesses()  : array<string|int, QueueProcess>
Gets all active processes.
getTableLocator()  : TableLocator
initialize()  : void
Initialize method
newEmptyEntity()  : QueueProcess
newEntities()  : array<string|int, QueueProcess>
newEntity()  : QueueProcess
patchEntities()  : array<string|int, QueueProcess>
patchEntity()  : QueueProcess
remove()  : void
save()  : QueueProcess|false
saveMany()  : ResultSetInterface<string|int, QueueProcess>|false
saveManyOrFail()  : ResultSetInterface<string|int, QueueProcess>
saveOrFail()  : QueueProcess
serverList()  : array<string, string>
status()  : array<string, mixed>
If pid logging is enabled, will return an array with - time: Timestamp as DateTime object - workers: int Count of currently running workers
terminateProcess()  : void
Note this does not work from the web backend to kill CLI workers.
update()  : void
validateCount()  : string|bool
validationDefault()  : Validator
Default validation rules.
wakeUpWorkers()  : void
Sends a SIGUSR1 to all workers. This will only affect workers running with config option canInterruptSleep set to true.
logImpersonationAction()  : void
Record impersonated writes to audit log table.

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

add()

public add(string $pid, string $key) : int
Parameters
$pid : string
$key : string
Return values
int

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

buildServerString()

Use ENV to control the server name of the servers run workers with.

public buildServerString() : string|null

export SERVER_NAME=myserver1

This way you can deploy separately and only end the processes of that server.

Return values
string|null

defaultConnectionName()

Sets connection name

public static defaultConnectionName() : string
Return values
string

deleteMany()

public deleteMany(iterable<string|int, mixed> $entities[, array<string|int, mixed> $options = = '[]' ]) : ResultSetInterface<string|int, QueueProcess>|false
Parameters
$entities : iterable<string|int, mixed>
$options : array<string|int, mixed> = = '[]'
Return values
ResultSetInterface<string|int, QueueProcess>|false

deleteManyOrFail()

public deleteManyOrFail(iterable<string|int, mixed> $entities[, array<string|int, mixed> $options = = '[]' ]) : ResultSetInterface<string|int, QueueProcess>
Parameters
$entities : iterable<string|int, mixed>
$options : array<string|int, mixed> = = '[]'
Return values
ResultSetInterface<string|int, QueueProcess>

endProcess()

Soft ending of a running job, e.g. when migration is starting

public endProcess(string $pid) : void
Parameters
$pid : string

findOrCreate()

public findOrCreate(mixed $search[, callable|null $callback = = 'null' ][, array<string|int, mixed> $options = = '[]' ]) : QueueProcess
Parameters
$search : mixed
$callback : callable|null = = 'null'
$options : array<string|int, mixed> = = '[]'
Return values
QueueProcess

get()

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

getProcesses()

Gets all active processes.

public getProcesses([bool $forThisServer = false ]) : array<string|int, QueueProcess>

$forThisServer only works for DB approach.

Parameters
$forThisServer : bool = false
Return values
array<string|int, QueueProcess>

initialize()

Initialize method

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

The configuration for the Table.

newEntities()

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

newEntity()

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

patchEntities()

public patchEntities(iterable<string|int, mixed> $entities, array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : array<string|int, QueueProcess>
Parameters
$entities : iterable<string|int, mixed>
$data : array<string|int, mixed>
$options : array<string|int, mixed> = = '[]'
Return values
array<string|int, QueueProcess>

patchEntity()

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

save()

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

saveMany()

public saveMany(iterable<string|int, mixed> $entities[, array<string|int, mixed> $options = = '[]' ]) : ResultSetInterface<string|int, QueueProcess>|false
Parameters
$entities : iterable<string|int, mixed>
$options : array<string|int, mixed> = = '[]'
Return values
ResultSetInterface<string|int, QueueProcess>|false

saveManyOrFail()

public saveManyOrFail(iterable<string|int, mixed> $entities[, array<string|int, mixed> $options = = '[]' ]) : ResultSetInterface<string|int, QueueProcess>
Parameters
$entities : iterable<string|int, mixed>
$options : array<string|int, mixed> = = '[]'
Return values
ResultSetInterface<string|int, QueueProcess>

saveOrFail()

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

serverList()

public serverList() : array<string, string>
Return values
array<string, string>

status()

If pid logging is enabled, will return an array with - time: Timestamp as DateTime object - workers: int Count of currently running workers

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

terminateProcess()

Note this does not work from the web backend to kill CLI workers.

public terminateProcess(string $pid[, int $sig = SIGTERM ]) : void

We might need to run some exec() kill command here instead.

Parameters
$pid : string
$sig : int = SIGTERM

Signal (defaults to graceful SIGTERM = 15)

validateCount()

public validateCount(string $value, array<string, mixed> $context) : string|bool
Parameters
$value : string
$context : array<string, mixed>
Return values
string|bool

validationDefault()

Default validation rules.

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

Validator instance.

Return values
Validator

wakeUpWorkers()

Sends a SIGUSR1 to all workers. This will only affect workers running with config option canInterruptSleep set to true.

public wakeUpWorkers() : void

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


        
On this page

Search results