KMP PHP API Reference

SyncActiveWindowStatusesCommand extends Command
in package

CLI command to synchronize ActiveWindow-based entity statuses.

Supports dual-path dispatch: when an 'active-window-sync' workflow is active, delegates to the workflow engine; otherwise runs legacy transition logic. Dispatches per kingdom when kingdoms are configured so workflow actions can still use kingdom context without persisted tenant-scoped definitions.

Transition entities from Upcoming -> Current and Current -> Expired based on their configured start_on/expires_on window. Intended for scheduled execution via cron or other automation.

Table of Contents

Properties

$triggerDispatcher  : TriggerDispatcher|null
Injected dispatcher. Tests may set this manually when constructing the command directly.

Methods

__construct()  : mixed
buildOptionParser()  : ConsoleOptionParser
execute()  : int
Execute command with dual-path dispatch.
setTriggerDispatcher()  : void
Set a custom TriggerDispatcher (for testing).
collectTableAliases()  : array<string|int, string>
Collect table aliases from the application or a plugin.
discoverActiveWindowTableAliases()  : array<string|int, string>
Discover table aliases whose entities extend ActiveWindowBaseEntity.
dispatchViaWorkflow()  : bool
Attempt to dispatch via the workflow engine.
evaluateAlias()  : array<string|int, string>
Evaluate alias and append when entity inherits ActiveWindowBaseEntity.
executeLegacy()  : int
Run the legacy active window sync logic.
synchronizeTable()  : array{upcoming_to_current: int, current_to_expired: int, errors: int}
Synchronize statuses for a table whose entity extends ActiveWindowBaseEntity.
getTriggerDispatcher()  : TriggerDispatcher
Resolve the workflow trigger dispatcher.

Properties

Methods

buildOptionParser()

public buildOptionParser(ConsoleOptionParser $parser) : ConsoleOptionParser
Parameters
$parser : ConsoleOptionParser
Tags
inheritDoc
Return values
ConsoleOptionParser

execute()

Execute command with dual-path dispatch.

public execute(Arguments $args, ConsoleIo $io) : int
Parameters
$args : Arguments

Console arguments instance.

$io : ConsoleIo

Console IO instance.

Return values
int

collectTableAliases()

Collect table aliases from the application or a plugin.

protected collectTableAliases([string|null $plugin = null ]) : array<string|int, string>
Parameters
$plugin : string|null = null

Plugin name when searching plugin tables.

Return values
array<string|int, string>

discoverActiveWindowTableAliases()

Discover table aliases whose entities extend ActiveWindowBaseEntity.

protected discoverActiveWindowTableAliases(TableLocator $tableLocator) : array<string|int, string>
Parameters
$tableLocator : TableLocator

Table locator instance.

Return values
array<string|int, string>

dispatchViaWorkflow()

Attempt to dispatch via the workflow engine.

protected dispatchViaWorkflow(ConsoleIo $io) : bool

Iterates over all kingdoms when a global workflow definition is active.

Parameters
$io : ConsoleIo

Console IO instance.

Return values
bool

True if workflow was dispatched, false to fall back to legacy.

evaluateAlias()

Evaluate alias and append when entity inherits ActiveWindowBaseEntity.

protected evaluateAlias(TableLocator $tableLocator, array<string|int, string> $aliases, string $alias) : array<string|int, string>
Parameters
$tableLocator : TableLocator

Table locator instance.

$aliases : array<string|int, string>

Current alias list

$alias : string

Alias to evaluate

Return values
array<string|int, string>

executeLegacy()

Run the legacy active window sync logic.

protected executeLegacy(Arguments $args, ConsoleIo $io) : int
Parameters
$args : Arguments

Console arguments instance.

$io : ConsoleIo

Console IO instance.

Return values
int

synchronizeTable()

Synchronize statuses for a table whose entity extends ActiveWindowBaseEntity.

protected synchronizeTable(Table $table, FrozenTime $now, bool $dryRun, ConsoleIo $io) : array{upcoming_to_current: int, current_to_expired: int, errors: int}
Parameters
$table : Table

Target table instance.

$now : FrozenTime

Current timestamp reference.

$dryRun : bool

Whether to skip persistence.

$io : ConsoleIo

Console IO.

Return values
array{upcoming_to_current: int, current_to_expired: int, errors: int}
On this page

Search results