RecommendationApprovalWorkflowSyncService
in package
uses
LocatorAwareTrait
Restarts open award recommendation approvals against current configuration.
Table of Contents
Constants
- ACTIVE_SYNC_FAILURE_REASON : mixed = 'Active recommendation approval workflow restar...
- APPROVAL_STATES : mixed = ['Submitted', 'In Consideration', 'Awaiting Fee...
Properties
- $lifecycleService : RecommendationApprovalWorkflowLifecycleService
- $workflowEngine : WorkflowEngineInterface
Methods
- __construct() : mixed
- countOutdatedRecommendations() : int
- Count active recommendations assigned to a process but running an older configuration.
- findOutdatedRecommendationRunMap() : array<int, array<string|int, int>>
- Find active runs that differ from the process or workflow currently assigned to their recommendations.
- restartRecommendation() : array{status: string, cancelledRunCount?: int, newRunId?: int}
- Restart all active runs for one eligible recommendation atomically.
- syncApprovalProcess() : ServiceResult
- Restart only outdated active recommendation approvals assigned to one current process.
- isEligibleForRestart() : bool
- Terminal, grouped, deleted, and bestowal-owned recommendations are never restarted.
- isRunOutdated() : bool
- Determine whether one run predates the current process snapshot or workflow definition.
- latestLegacyConfigurationChange() : DateTime|null
- Find the latest step change for pre-snapshot runs, including soft-deleted steps.
- restartRecommendations() : void
- Restart selected recommendations and add their outcomes to a bulk summary.
Constants
ACTIVE_SYNC_FAILURE_REASON
private
mixed
ACTIVE_SYNC_FAILURE_REASON
= 'Active recommendation approval workflow restart failed. Review server logs for details.'
APPROVAL_STATES
private
mixed
APPROVAL_STATES
= ['Submitted', 'In Consideration', 'Awaiting Feedback']
Properties
$lifecycleService
private
RecommendationApprovalWorkflowLifecycleService
$lifecycleService
$workflowEngine
private
WorkflowEngineInterface
$workflowEngine
Methods
__construct()
public
__construct(WorkflowEngineInterface $workflowEngine[, RecommendationApprovalWorkflowLifecycleService|null $lifecycleService = null ]) : mixed
Parameters
- $workflowEngine : WorkflowEngineInterface
-
Workflow runtime.
- $lifecycleService : RecommendationApprovalWorkflowLifecycleService|null = null
-
Lifecycle owner.
countOutdatedRecommendations()
Count active recommendations assigned to a process but running an older configuration.
public
countOutdatedRecommendations(int $approvalProcessId) : int
Parameters
- $approvalProcessId : int
Return values
intfindOutdatedRecommendationRunMap()
Find active runs that differ from the process or workflow currently assigned to their recommendations.
public
findOutdatedRecommendationRunMap(int $approvalProcessId[, array<string|int, mixed>|null $recommendationIds = null ]) : array<int, array<string|int, int>>
Parameters
- $approvalProcessId : int
- $recommendationIds : array<string|int, mixed>|null = null
Return values
array<int, array<string|int, int>> —Active run IDs keyed by recommendation ID.
restartRecommendation()
Restart all active runs for one eligible recommendation atomically.
public
restartRecommendation(int $recommendationId, int $approvalProcessId, array<string|int, mixed> $expectedRunIds, int $actorId) : array{status: string, cancelledRunCount?: int, newRunId?: int}
Parameters
- $recommendationId : int
- $approvalProcessId : int
- $expectedRunIds : array<string|int, mixed>
- $actorId : int
Return values
array{status: string, cancelledRunCount?: int, newRunId?: int}syncApprovalProcess()
Restart only outdated active recommendation approvals assigned to one current process.
public
syncApprovalProcess(int $approvalProcessId, int $actorId) : ServiceResult
Active progress is never mapped into the replacement workflow. Each recommendation is isolated in its own transaction so a failed restart preserves its original workflow.
Parameters
- $approvalProcessId : int
-
Approval process whose assigned recommendations may restart.
- $actorId : int
-
Member performing the synchronization.
Return values
ServiceResultisEligibleForRestart()
Terminal, grouped, deleted, and bestowal-owned recommendations are never restarted.
private
isEligibleForRestart(Recommendation $recommendation, int $approvalProcessId) : bool
Parameters
- $recommendation : Recommendation
- $approvalProcessId : int
Return values
boolisRunOutdated()
Determine whether one run predates the current process snapshot or workflow definition.
private
isRunOutdated(RecommendationApprovalRun $run, ApprovalProcess $process, DateTime|null $legacyChangedAt) : bool
Parameters
- $run : RecommendationApprovalRun
- $process : ApprovalProcess
- $legacyChangedAt : DateTime|null
Return values
boollatestLegacyConfigurationChange()
Find the latest step change for pre-snapshot runs, including soft-deleted steps.
private
latestLegacyConfigurationChange(int $approvalProcessId) : DateTime|null
Parameters
- $approvalProcessId : int
Return values
DateTime|nullrestartRecommendations()
Restart selected recommendations and add their outcomes to a bulk summary.
private
restartRecommendations(array<int, array<string|int, int>> $outdatedRunMap, int $approvalProcessId, int $actorId, array<string, mixed> &$summary) : void
Parameters
- $outdatedRunMap : array<int, array<string|int, int>>
-
Run IDs keyed by recommendation ID.
- $approvalProcessId : int
-
Current approval process ID.
- $actorId : int
-
Synchronizing member ID.
- $summary : array<string, mixed>
-
Bulk summary, updated in place.