RecommendationStateService
in package
Handles recommendation state machine transitions and bulk state updates.
Encapsulates the transactional logic for changing recommendation states, including gathering assignment, given-date setting, close-reason recording, and bulk-note creation. Also handles kanban drag-and-drop reordering.
Tags
Table of Contents
Methods
- bulkUpdateStates() : bool
- Perform a transactional bulk state transition for multiple recommendations.
- kanbanMove() : string
- Update a single recommendation's state and position for kanban drag-and-drop.
Methods
bulkUpdateStates()
Perform a transactional bulk state transition for multiple recommendations.
public
bulkUpdateStates(Table $recommendationsTable, array{ids: string[], newState: string, gathering_id: string|null, given: string|null, note: string|null, close_reason: string|null} $data, int $authorId) : bool
Parameters
- $recommendationsTable : Table
-
The Recommendations ORM table instance.
- $data : array{ids: string[], newState: string, gathering_id: string|null, given: string|null, note: string|null, close_reason: string|null}
-
Bulk update parameters.
- $authorId : int
-
The current user ID for note attribution.
Return values
bool —True on success, false on failure.
kanbanMove()
Update a single recommendation's state and position for kanban drag-and-drop.
public
kanbanMove(Table $recommendationsTable, Recommendation $recommendation, string $newCol, string|int|null $placeBefore, string|int|null $placeAfter) : string
Parameters
- $recommendationsTable : Table
-
The Recommendations ORM table instance.
- $recommendation : Recommendation
-
The recommendation entity.
- $newCol : string
-
The new kanban column (state) value.
- $placeBefore : string|int|null
-
ID of the recommendation to place before, or -1/null.
- $placeAfter : string|int|null
-
ID of the recommendation to place after, or -1/null.
Return values
string —'success' or 'failed'.