RecommendationStateLogService
in package
uses
LocatorAwareTrait
Centralizes recommendation state-log creation for entity and bulk transitions.
Table of Contents
Properties
- $stateLogsTable : Table
Methods
- __construct() : mixed
- createLog() : RecommendationsStatesLog
- Create a single immutable recommendation state-log entry.
- inferStatusForState() : string
- Infer the owning status name for a workflow state.
- logEntityStateChange() : RecommendationsStatesLog|null
- Persist the state change represented by a dirty recommendation entity.
- logStateTransition() : RecommendationsStatesLog|null
- Create a state-log entry when a transition changes the saved state/status pair.
Properties
$stateLogsTable
private
Table
$stateLogsTable
Methods
__construct()
public
__construct([Table|null $stateLogsTable = null ]) : mixed
Parameters
- $stateLogsTable : Table|null = null
-
Optional injected state-log table.
createLog()
Create a single immutable recommendation state-log entry.
public
createLog(int $recommendationId, string $fromState, string $toState, string $fromStatus, string $toStatus[, int|null $createdBy = null ]) : RecommendationsStatesLog
Parameters
- $recommendationId : int
-
Recommendation ID.
- $fromState : string
-
Prior state name.
- $toState : string
-
New state name.
- $fromStatus : string
-
Prior status name.
- $toStatus : string
-
New status name.
- $createdBy : int|null = null
-
Actor ID.
Return values
RecommendationsStatesLoginferStatusForState()
Infer the owning status name for a workflow state.
public
inferStatusForState(string $state) : string
Parameters
- $state : string
-
Recommendation state name.
Return values
stringlogEntityStateChange()
Persist the state change represented by a dirty recommendation entity.
public
logEntityStateChange(Recommendation $recommendation) : RecommendationsStatesLog|null
Parameters
- $recommendation : Recommendation
-
Recommendation with a dirty state field.
Return values
RecommendationsStatesLog|nulllogStateTransition()
Create a state-log entry when a transition changes the saved state/status pair.
public
logStateTransition(int $recommendationId, string $fromState, string $toState[, string|null $fromStatus = null ][, string|null $toStatus = null ][, int|null $createdBy = null ]) : RecommendationsStatesLog|null
Parameters
- $recommendationId : int
-
Recommendation ID.
- $fromState : string
-
Prior state name.
- $toState : string
-
New state name.
- $fromStatus : string|null = null
-
Prior status name.
- $toStatus : string|null = null
-
New status name.
- $createdBy : int|null = null
-
Actor ID.