WorkflowSchedulesTable
extends BaseTable
in package
WorkflowSchedules Model
Tracks last/next run times for scheduled workflow definitions.
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}> = []
- CLAIM_LEASE_SECONDS : mixed = 900
Properties
- $WorkflowDefinitions : WorkflowDefinitionsTable|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.
- buildRules() : RulesChecker
- claimExecution() : string|null
- Atomically claim a schedule snapshot for dispatch.
- completeExecutionClaim() : bool
- Record a successful dispatch and release its lease.
- findOrCreate() : WorkflowSchedule
- get() : WorkflowSchedule
- getOrCreateForDefinition() : WorkflowSchedule
- Return the single schedule row, tolerating a concurrent first insert.
- initialize() : void
- newEmptyEntity() : WorkflowSchedule
- newEntity() : WorkflowSchedule
- patchEntity() : WorkflowSchedule
- releaseExecutionClaim() : bool
- Release a failed dispatch without consuming the scheduled occurrence.
- saveOrFail() : WorkflowSchedule
- validationDefault() : Validator
- logImpersonationAction() : void
- Record impersonated writes to audit log table.
- setJsonColumnTypesIfPresent() : void
- Mark JSON columns when the table schema is available.
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
CLAIM_LEASE_SECONDS
private
mixed
CLAIM_LEASE_SECONDS
= 900
Properties
$WorkflowDefinitions
public
WorkflowDefinitionsTable|BelongsTo
$WorkflowDefinitions
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
buildRules()
public
buildRules(RulesChecker $rules) : RulesChecker
Parameters
- $rules : RulesChecker
-
Rules checker instance
Return values
RulesCheckerclaimExecution()
Atomically claim a schedule snapshot for dispatch.
public
claimExecution(WorkflowSchedule $schedule, DateTime $claimedAt) : string|null
The expected last_run_at prevents a worker with a stale pre-claim read from reclaiming a schedule that another worker has already completed. Dispatch callers should hold the surrounding transaction open until they complete the claim so the updated row remains locked during execution.
Parameters
- $schedule : WorkflowSchedule
- $claimedAt : DateTime
Return values
string|nullcompleteExecutionClaim()
Record a successful dispatch and release its lease.
public
completeExecutionClaim(int $scheduleId, string $claimToken, DateTime $lastRunAt, DateTime $nextRunAt) : bool
Parameters
- $scheduleId : int
- $claimToken : string
- $lastRunAt : DateTime
- $nextRunAt : DateTime
Return values
boolfindOrCreate()
public
findOrCreate(mixed $search[, callable|null $callback = = 'null' ][, array<string|int, mixed> $options = = '[]' ]) : WorkflowSchedule
Parameters
- $search : mixed
- $callback : callable|null = = 'null'
- $options : array<string|int, mixed> = = '[]'
Return values
WorkflowScheduleget()
public
get(mixed $primaryKey[, array<string|int, mixed>|string $finder = = '\'all\'' ][, CacheInterface|string|null $cache = = 'null' ][, Closure|string|null $cacheKey = = 'null' ], mixed ...$args) : WorkflowSchedule
Parameters
- $primaryKey : mixed
- $finder : array<string|int, mixed>|string = = '\'all\''
- $cache : CacheInterface|string|null = = 'null'
- $cacheKey : Closure|string|null = = 'null'
- $args : mixed
Return values
WorkflowSchedulegetOrCreateForDefinition()
Return the single schedule row, tolerating a concurrent first insert.
public
getOrCreateForDefinition(int $workflowDefinitionId) : WorkflowSchedule
Parameters
- $workflowDefinitionId : int
Return values
WorkflowScheduleinitialize()
public
initialize(array<string|int, mixed> $config) : void
Parameters
- $config : array<string|int, mixed>
-
Configuration options
newEmptyEntity()
public
newEmptyEntity() : WorkflowSchedule
Return values
WorkflowSchedulenewEntity()
public
newEntity(array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : WorkflowSchedule
Parameters
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
WorkflowSchedulepatchEntity()
public
patchEntity(EntityInterface $entity, array<string|int, mixed> $data[, array<string|int, mixed> $options = = '[]' ]) : WorkflowSchedule
Parameters
- $entity : EntityInterface
- $data : array<string|int, mixed>
- $options : array<string|int, mixed> = = '[]'
Return values
WorkflowSchedulereleaseExecutionClaim()
Release a failed dispatch without consuming the scheduled occurrence.
public
releaseExecutionClaim(int $scheduleId, string $claimToken) : bool
Parameters
- $scheduleId : int
- $claimToken : string
Return values
boolsaveOrFail()
public
saveOrFail(EntityInterface $entity[, array<string|int, mixed> $options = = '[]' ]) : WorkflowSchedule
Parameters
- $entity : EntityInterface
- $options : array<string|int, mixed> = = '[]'
Return values
WorkflowSchedulevalidationDefault()
public
validationDefault(Validator $validator) : Validator
Parameters
- $validator : Validator
-
Validator instance
Return values
ValidatorlogImpersonationAction()
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.