KMP PHP API Reference

OfficerWorkflowActions
in package
uses QueuedMailerAwareTrait, WorkflowContextAwareTrait

Workflow action implementations for officer lifecycle operations.

Uses injected ActiveWindowManagerInterface and WarrantManagerInterface rather than direct instantiation.

Table of Contents

Properties

$mailer  : Mailer
$activeWindowManager  : ActiveWindowManagerInterface
$officerManager  : OfficerManagerInterface|null
$triggerDispatcher  : TriggerDispatcher|null
$warrantManager  : WarrantManagerInterface

Methods

__construct()  : mixed
calculateReportingFieldsAction()  : array<string|int, mixed>
Calculate reporting hierarchy fields for an officer.
createOfficerRecord()  : array<string|int, mixed>
Create an officer record with reporting fields, ActiveWindow start, and role assignment.
prepareHireNotificationVars()  : array<string|int, mixed>
Prepare all hire-notification email variables for use by Core.SendEmail.
prepareReleaseNotificationVars()  : array<string|int, mixed>
Prepare all release-notification email variables for use by Core.SendEmail.
recalculateOfficersForOffice()  : array<string|int, mixed>
Batch recalculate all officers when office configuration changes.
releaseConflictingOfficers()  : array<string|int, mixed>
Resolve existing officers when a one-per-branch office gets a new assignment.
releaseOfficer()  : array<string|int, mixed>
Release an officer using the same lifecycle steps as the legacy manager path.
requestWarrantRoster()  : array<string|int, mixed>
Request a warrant roster for a newly hired officer.
queueMail()  : Mailer
Returns a mailer instance.
queueMailJob()  : void
Queues a mail job to be processed later.
resolveValue()  : mixed
Resolve a config value from context if it starts with '$.'.
sendMailNow()  : Mailer
Returns a mailer instance.
applyConflictDateAdjustment()  : void
calculateReportingFields()  : array<string|int, mixed>
Calculate reporting relationships for an officer based on office config.
deriveActiveWindowStatus()  : string
deriveWarrantStatus()  : string
determineConflictResolution()  : DateTime|null}
dispatchReplacementRelease()  : void
extractWorkflowDispatchFailure()  : string|null
Extract the first workflow dispatch failure from trigger results.
formatOptionalDate()  : string
queueAdjustmentNotification()  : void
resolveEffectiveOfficerEndDate()  : DateTime|null
syncGrantedMemberRoleDates()  : void
syncOfficerWarrantDates()  : void
windowsOverlap()  : bool

Properties

Methods

calculateReportingFieldsAction()

Calculate reporting hierarchy fields for an officer.

public calculateReportingFieldsAction(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>

Standalone action wrapping the complex hierarchy traversal logic so it can be invoked independently in a workflow step.

Parameters
$context : array<string|int, mixed>

Current workflow context

$config : array<string|int, mixed>

Action config with officeId, branchId, officerId

Return values
array<string|int, mixed>

Reporting field values

createOfficerRecord()

Create an officer record with reporting fields, ActiveWindow start, and role assignment.

public createOfficerRecord(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>

Unique-office conflict release is handled earlier in the workflow graph.

Parameters
$context : array<string|int, mixed>

Current workflow context

$config : array<string|int, mixed>

Action config

Return values
array<string|int, mixed>

Output with officerId

prepareHireNotificationVars()

Prepare all hire-notification email variables for use by Core.SendEmail.

public prepareHireNotificationVars(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>

Loads officer, member, and branch records; formats dates; and resolves the warrant-required notice text. Outputs vars for the officer-hire-notification DB template into workflow context.

Parameters
$context : array<string|int, mixed>

Current workflow context

$config : array<string|int, mixed>

Action config with officerId

Return values
array<string|int, mixed>

Output with hire notification vars

prepareReleaseNotificationVars()

Prepare all release-notification email variables for use by Core.SendEmail.

public prepareReleaseNotificationVars(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>

Loads officer, member, and branch records; formats the release date; and resolves the reason. Outputs vars for the officer-release-notification DB template into workflow context.

Parameters
$context : array<string|int, mixed>

Current workflow context

$config : array<string|int, mixed>

Action config with officerId, reason

Return values
array<string|int, mixed>

Output with release notification vars

recalculateOfficersForOffice()

Batch recalculate all officers when office configuration changes.

public recalculateOfficersForOffice(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>

Delegates to OfficerManagerInterface::recalculateOfficersForOffice().

Parameters
$context : array<string|int, mixed>

Current workflow context

$config : array<string|int, mixed>

Action config with officeId, updaterId

Return values
array<string|int, mixed>

Updated count

releaseConflictingOfficers()

Resolve existing officers when a one-per-branch office gets a new assignment.

public releaseConflictingOfficers(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>
Parameters
$context : array<string|int, mixed>

Current workflow context

$config : array<string|int, mixed>

Action config with officeId, branchId, newOfficerStartDate, newOfficerEndDate

Return values
array<string|int, mixed>

Lists of released and adjusted officer IDs

releaseOfficer()

Release an officer using the same lifecycle steps as the legacy manager path.

public releaseOfficer(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>

This mirrors DefaultOfficerManager::release() without re-dispatching Officers.Released from inside the workflow.

Parameters
$context : array<string|int, mixed>

Current workflow context

$config : array<string|int, mixed>

Action config with officerId, releasedById, reason, expiresOn, releaseStatus

Return values
array<string|int, mixed>

Output with released boolean

requestWarrantRoster()

Request a warrant roster for a newly hired officer.

public requestWarrantRoster(array<string|int, mixed> $context, array<string|int, mixed> $config) : array<string|int, mixed>

Creates the roster and dispatches Warrants.RosterCreated trigger, which kicks off the warrant-roster approval workflow.

Parameters
$context : array<string|int, mixed>

Current workflow context

$config : array<string|int, mixed>

Action config with officerId

Return values
array<string|int, mixed>

Output with rosterId

queueMail()

Returns a mailer instance.

protected queueMail(string $name, mixed $action, mixed $to, mixed $vars) : Mailer
Parameters
$name : string

Mailer's name.

$action : mixed
$to : mixed
$vars : mixed
Tags
throws
MissingMailerException

if undefined mailer class.

Return values
Mailer

queueMailJob()

Queues a mail job to be processed later.

protected queueMailJob(array<string|int, mixed> $data) : void
Parameters
$data : array<string|int, mixed>

Data to be passed to the mailer.

resolveValue()

Resolve a config value from context if it starts with '$.'.

protected resolveValue(mixed $value, array<string|int, mixed> $context) : mixed
Parameters
$value : mixed

Raw value or context path (e.g. '$.trigger.memberId')

$context : array<string|int, mixed>

Current workflow context

Return values
mixed

Resolved value

sendMailNow()

Returns a mailer instance.

protected sendMailNow(array<string|int, mixed> $data) : Mailer
Parameters
$data : array<string|int, mixed>
Tags
throws
MissingMailerException

if undefined mailer class.

Return values
Mailer

applyConflictDateAdjustment()

private applyConflictDateAdjustment(Officer $officer, DateTime $newStart, DateTime|null $newEnd, int $adjustedById, string $reason, object $office) : void
Parameters
$officer : Officer
$newStart : DateTime
$newEnd : DateTime|null
$adjustedById : int
$reason : string
$office : object

calculateReportingFields()

Calculate reporting relationships for an officer based on office config.

private calculateReportingFields(object $office, object $officer) : array<string|int, mixed>
Parameters
$office : object
$officer : object
Return values
array<string|int, mixed>

deriveActiveWindowStatus()

private deriveActiveWindowStatus(DateTime $startOn, DateTime|null $expiresOn) : string
Parameters
$startOn : DateTime
$expiresOn : DateTime|null
Return values
string

deriveWarrantStatus()

private deriveWarrantStatus(string $currentStatus, DateTime $startOn, DateTime|null $expiresOn) : string
Parameters
$currentStatus : string
$startOn : DateTime
$expiresOn : DateTime|null
Return values
string

determineConflictResolution()

private determineConflictResolution(Officer $existing, DateTime $newStart, DateTime|null $newEnd) : DateTime|null}
Parameters
$existing : Officer
$newStart : DateTime
$newEnd : DateTime|null
Return values
DateTime|null}

dispatchReplacementRelease()

private dispatchReplacementRelease(Officer $existing, int $releasedById, DateTime $startDate, array<string|int, mixed> $context) : void
Parameters
$existing : Officer
$releasedById : int
$startDate : DateTime
$context : array<string|int, mixed>

extractWorkflowDispatchFailure()

Extract the first workflow dispatch failure from trigger results.

private extractWorkflowDispatchFailure(array<int, mixed> $results, string $defaultMessage) : string|null
Parameters
$results : array<int, mixed>

Workflow dispatch results.

$defaultMessage : string

Fallback error message.

Return values
string|null

formatOptionalDate()

private formatOptionalDate(DateTime|null $date) : string
Parameters
$date : DateTime|null
Return values
string

queueAdjustmentNotification()

private queueAdjustmentNotification(Officer $officer, object $office, DateTime $previousStart, DateTime|null $previousEnd, DateTime $newStart, DateTime|null $newEnd, string $reason) : void
Parameters
$officer : Officer
$office : object
$previousStart : DateTime
$previousEnd : DateTime|null
$newStart : DateTime
$newEnd : DateTime|null
$reason : string

resolveEffectiveOfficerEndDate()

private resolveEffectiveOfficerEndDate(int $officeId, DateTime $startDate, mixed $endDateRaw) : DateTime|null
Parameters
$officeId : int
$startDate : DateTime
$endDateRaw : mixed
Return values
DateTime|null

syncGrantedMemberRoleDates()

private syncGrantedMemberRoleDates(Officer $officer, DateTime $newStart, DateTime|null $newEnd, int $adjustedById, string $reason) : void
Parameters
$officer : Officer
$newStart : DateTime
$newEnd : DateTime|null
$adjustedById : int
$reason : string

syncOfficerWarrantDates()

private syncOfficerWarrantDates(Officer $officer, DateTime $newStart, DateTime|null $newEnd, int $adjustedById, string $reason) : void
Parameters
$officer : Officer
$newStart : DateTime
$newEnd : DateTime|null
$adjustedById : int
$reason : string

windowsOverlap()

private windowsOverlap(DateTime $existingStart, DateTime|null $existingEnd, DateTime $newStart, DateTime|null $newEnd) : bool
Parameters
$existingStart : DateTime
$existingEnd : DateTime|null
$newStart : DateTime
$newEnd : DateTime|null
Return values
bool
On this page

Search results