KMP PHP API Reference

RecommendationApprovalProcessService
in package
uses LocatorAwareTrait

Bridges award recommendation approval process config to workflow runtime state.

Table of Contents

Properties

$resolver  : AwardApprovalResolverService

Methods

__construct()  : mixed
advanceProcess()  : ServiceResult
Advance the run projection after a workflow approval node resolves.
buildStepOutput()  : array<string, mixed>
Build workflow action output for one step.
completedStepKeys()  : array<int, string>
Return stable keys for approval gates already completed in this run.
isFinalApprovalStep()  : bool|null
Determine whether an approval belongs to the last configured step of its award approval process.
resolveConfiguredApproverIds()  : array<string|int, int>
Dynamic workflow approval callback for configured award approval steps.
startProcess()  : ServiceResult
Start or reuse an approval run for the current workflow instance.
approvalApproverConfig()  : array<string, mixed>
Build the dynamic approver resolver config.
approverIds()  : array<string|int, int>
Resolve approver IDs for a process step.
assertRunUsesRecommendationProcess()  : void
Reject stale runs before creating or advancing approval steps until synchronization upgrades them.
configuredStep()  : ApprovalProcessStep|null
Rehydrate a configured approval target from workflow approval config.
excludePriorApprovalResponders()  : array<string|int, int>
Remove members who have already responded to a prior approval in this workflow instance.
findStepIndex()  : int|null
Find a step index by key.
handleRejectedStep()  : ServiceResult
Close a rejected approval run.
loadGroupHeadRecommendation()  : Recommendation
Load a recommendation group head with approval process context.
nextIncompleteStep()  : ApprovalProcessStep|null
Find the next configured step that has not already completed in this run.
orderedSteps()  : array<int, ApprovalProcessStep>
Sort process steps by sequence.
requiredCount()  : int
Compute required count from the configured threshold.
resolveActorId()  : int|null
Resolve actor ID from config or trigger context.
resolveApprovalStatus()  : string
Resolve an approval outcome from workflow context or action config.
resolveInstanceId()  : int
Resolve workflow instance ID from workflow context.
resolveKickbackStep()  : ApprovalProcessStep
Resolve a kickback action to a target step.
resolveRecommendationId()  : int
Resolve recommendation ID from config or trigger context.
resolveRejectionComment()  : string|null
Resolve the reject comment from workflow resume/action context.
saveRejectionCloseReason()  : void
Persist the rejection reason without mutating legacy recommendation status/state.
syncBlockedFlag()  : void
Persist (only on transitions) whether a pending gate currently has an empty approver pool, so admin views can badge blocked approvals without resolving every pool per row.
syncRequiredCount()  : void
Keep dynamic workflow approval counts aligned with the current target pool.
updateRunStep()  : void
Update run current-step projection.

Properties

Methods

advanceProcess()

Advance the run projection after a workflow approval node resolves.

public advanceProcess(array<string, mixed> $context, array<string, mixed> $config) : ServiceResult
Parameters
$context : array<string, mixed>

Workflow context.

$config : array<string, mixed>

Node config.

Return values
ServiceResult

buildStepOutput()

Build workflow action output for one step.

public buildStepOutput(RecommendationApprovalRun $run, Recommendation $recommendation, ApprovalProcessStep $step[, int|null $currentApprovalId = null ][, array<int, string>|null $completedStepKeys = null ]) : array<string, mixed>
Parameters
$run : RecommendationApprovalRun

Approval run.

$recommendation : Recommendation

Recommendation.

$step : ApprovalProcessStep

Approval step.

$currentApprovalId : int|null = null

Pending approval whose responders remain eligible for this step.

$completedStepKeys : array<int, string>|null = null

Previously loaded completed stable step keys.

Return values
array<string, mixed>

isFinalApprovalStep()

Determine whether an approval belongs to the last configured step of its award approval process.

public isFinalApprovalStep(WorkflowApproval $approval, array<string, mixed> $config) : bool|null
Parameters
$approval : WorkflowApproval

Workflow approval.

$config : array<string, mixed>

Approval approver config.

Return values
bool|null

True/false when resolvable, null when this is not a configured award approval step.

startProcess()

Start or reuse an approval run for the current workflow instance.

public startProcess(array<string, mixed> $context, array<string, mixed> $config) : ServiceResult
Parameters
$context : array<string, mixed>

Workflow context.

$config : array<string, mixed>

Node config.

Return values
ServiceResult

assertRunUsesRecommendationProcess()

Reject stale runs before creating or advancing approval steps until synchronization upgrades them.

private assertRunUsesRecommendationProcess(RecommendationApprovalRun $run, Recommendation $recommendation) : void

Terminal rejection deliberately bypasses this guard so Sync Now can finish a rejected gate whose original workflow resume was interrupted.

Parameters
$run : RecommendationApprovalRun

Approval run.

$recommendation : Recommendation

Recommendation with current award process.

excludePriorApprovalResponders()

Remove members who have already responded to a prior approval in this workflow instance.

private excludePriorApprovalResponders(int $workflowInstanceId, array<string|int, int> $approverIds[, int|null $currentApprovalId = null ]) : array<string|int, int>
Parameters
$workflowInstanceId : int

Workflow instance ID.

$approverIds : array<string|int, int>

Candidate approver IDs.

$currentApprovalId : int|null = null

Current gate whose responders are not prior-step responders.

Return values
array<string|int, int>

nextIncompleteStep()

Find the next configured step that has not already completed in this run.

private nextIncompleteStep(array<int, ApprovalProcessStep$steps, int $currentIndex, array<int, string> $completedStepKeys) : ApprovalProcessStep|null

Only later steps are considered so adding or moving a step before the current step never rewinds an in-flight workflow.

Parameters
$steps : array<int, ApprovalProcessStep>

Ordered steps.

$currentIndex : int

Current step index.

$completedStepKeys : array<int, string>

Completed stable step keys.

Return values
ApprovalProcessStep|null

resolveActorId()

Resolve actor ID from config or trigger context.

private resolveActorId(array<string, mixed> $context, array<string, mixed> $config) : int|null
Parameters
$context : array<string, mixed>

Workflow context.

$config : array<string, mixed>

Node config.

Return values
int|null

resolveApprovalStatus()

Resolve an approval outcome from workflow context or action config.

private resolveApprovalStatus(array<string, mixed> $context, array<string, mixed> $config) : string
Parameters
$context : array<string, mixed>

Workflow context.

$config : array<string, mixed>

Node config.

Return values
string

resolveInstanceId()

Resolve workflow instance ID from workflow context.

private resolveInstanceId(array<string, mixed> $context) : int
Parameters
$context : array<string, mixed>

Workflow context.

Return values
int

resolveRecommendationId()

Resolve recommendation ID from config or trigger context.

private resolveRecommendationId(array<string, mixed> $context, array<string, mixed> $config) : int
Parameters
$context : array<string, mixed>

Workflow context.

$config : array<string, mixed>

Node config.

Return values
int

resolveRejectionComment()

Resolve the reject comment from workflow resume/action context.

private resolveRejectionComment(array<string, mixed> $context, array<string, mixed> $config) : string|null
Parameters
$context : array<string, mixed>

Workflow context.

$config : array<string, mixed>

Node config.

Return values
string|null

saveRejectionCloseReason()

Persist the rejection reason without mutating legacy recommendation status/state.

private saveRejectionCloseReason(Recommendation $recommendation, int|null $actorId[, string|null $closeReason = null ]) : void
Parameters
$recommendation : Recommendation

Recommendation.

$actorId : int|null

Actor ID.

$closeReason : string|null = null

Rejection comment to store as the close reason.

syncBlockedFlag()

Persist (only on transitions) whether a pending gate currently has an empty approver pool, so admin views can badge blocked approvals without resolving every pool per row.

private syncBlockedFlag(WorkflowApproval $approval, array<string|int, int> $approverIds) : void
Parameters
$approval : WorkflowApproval

Workflow approval.

$approverIds : array<string|int, int>

Current approver IDs.

syncRequiredCount()

Keep dynamic workflow approval counts aligned with the current target pool.

private syncRequiredCount(WorkflowApproval $approval, array<string, mixed> $config, array<string|int, int> $approverIds) : void
Parameters
$approval : WorkflowApproval

Workflow approval.

$config : array<string, mixed>

Workflow approval approver config.

$approverIds : array<string|int, int>

Current approver IDs.

On this page

Search results