KMP PHP API Reference

WarrantWorkflowActions
in package
uses QueuedMailerAwareTrait, WorkflowActionTrait, WorkflowContextAwareTrait

Workflow action implementations for warrant operations.

Delegates roster creation, approval, and decline to WarrantManagerInterface to avoid duplicating warrant lifecycle logic.

Table of Contents

Properties

$mailer  : Mailer
$warrantManager  : WarrantManagerInterface

Methods

__construct()  : mixed
activateWarrants()  : array<string|int, mixed>
Activate all pending warrants in an approved roster.
cancelByEntity()  : array<string|int, mixed>
Cancel all warrants for a specific entity.
createDirectWarrant()  : array<string|int, mixed>
Create and immediately activate a warrant without a roster.
createWarrantRoster()  : array<string|int, mixed>
Create a warrant roster with a single warrant request for approval.
declineRoster()  : array<string|int, mixed>
Decline a warrant roster and cancel all its pending warrants.
declineSingleWarrant()  : array<string|int, mixed>
Decline a single warrant (not the entire roster).
getWarrantPeriod()  : array<string|int, mixed>
Calculate warrant start/end dates via WarrantManager.
notifyWarrantIssued()  : array<string|int, mixed>
Send warrant-issued notification emails to each member in the roster.
revokeWarrant()  : array<string|int, mixed>
Cancel/revoke a specific warrant by ID.
validateWarrantability()  : array<string|int, mixed>
Check if a member is eligible to receive warrants.
coerceDateTime()  : DateTime|null
Normalize date-like action input values.
guard()  : array{success: bool, data: array, error: string|null}
Run action code and return a standard ActionResult envelope.
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.

Properties

Methods

activateWarrants()

Activate all pending warrants in an approved roster.

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

Syncs workflow approval data to roster tables, then delegates activation to WarrantManagerInterface::activateApprovedRoster().

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

Current workflow context

$config : array<string|int, mixed>

Config with rosterId

Return values
array<string|int, mixed>

Output with activated boolean and count

cancelByEntity()

Cancel all warrants for a specific entity.

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

Delegates to WarrantManagerInterface::cancelByEntity().

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

Current workflow context

$config : array<string|int, mixed>

Config with entityType, entityId, reason, revokerId, expiresOn

Return values
array<string|int, mixed>

Output with cancelled boolean

createDirectWarrant()

Create and immediately activate a warrant without a roster.

public createDirectWarrant(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>

Config with name, memberId, entityType, entityId, startOn, expiresOn, memberRoleId

Return values
array<string|int, mixed>

Output with warrantId

createWarrantRoster()

Create a warrant roster with a single warrant request for approval.

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

Delegates to WarrantManagerInterface::request().

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

Current workflow context

$config : array<string|int, mixed>

Config with name, description, entityType, entityId, memberId, startOn, expiresOn, memberRoleId

Return values
array<string|int, mixed>

Output with rosterId

declineRoster()

Decline a warrant roster and cancel all its pending warrants.

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

Syncs any approve responses that occurred before the decline, then delegates to WarrantManagerInterface::decline().

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

Current workflow context

$config : array<string|int, mixed>

Config with rosterId, reason, rejecterId

Return values
array<string|int, mixed>

Output with declined boolean

declineSingleWarrant()

Decline a single warrant (not the entire roster).

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

Delegates to WarrantManagerInterface::declineSingleWarrant().

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

Current workflow context

$config : array<string|int, mixed>

Config with warrantId, reason, rejecterId

Return values
array<string|int, mixed>

Output with declined boolean

getWarrantPeriod()

Calculate warrant start/end dates via WarrantManager.

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

Delegates to WarrantManagerInterface::getWarrantPeriod().

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

Current workflow context

$config : array<string|int, mixed>

Config with startOn, endOn (optional)

Return values
array<string|int, mixed>

Output with startDate, endDate, periodId

notifyWarrantIssued()

Send warrant-issued notification emails to each member in the roster.

public notifyWarrantIssued(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>

Config with rosterId

Return values
array<string|int, mixed>

Output with emailsSent count

revokeWarrant()

Cancel/revoke a specific warrant by ID.

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

Delegates to WarrantManagerInterface::cancel().

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

Current workflow context

$config : array<string|int, mixed>

Config with warrantId, reason, revokerId, expiresOn

Return values
array<string|int, mixed>

Output with revoked boolean

validateWarrantability()

Check if a member is eligible to receive warrants.

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

Verifies the member.warrantable flag and that membership has not expired.

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

Current workflow context

$config : array<string|int, mixed>

Config with memberId

Return values
array<string|int, mixed>

Output with warrantable boolean and reason

coerceDateTime()

Normalize date-like action input values.

protected coerceDateTime(mixed $value[, string|null $default = null ]) : DateTime|null
Parameters
$value : mixed

DateTime, string, or null

$default : string|null = null

Default date/time expression for null input

Return values
DateTime|null

guard()

Run action code and return a standard ActionResult envelope.

protected guard(string $name, callable $fn) : array{success: bool, data: array, error: string|null}
Parameters
$name : string

Action name for logging

$fn : callable

Action implementation

Return values
array{success: bool, data: array, error: string|null}

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
On this page

Search results