RecommendationFeedbackService
in package
uses
LocatorAwareTrait
Creates and manages out-of-band feedback requests for award recommendations.
Table of Contents
Constants
- EVENT_FEEDBACK_EXPIRED : mixed = 'Awards.RecommendationFeedbackExpired'
- EVENT_FEEDBACK_REQUESTED : mixed = 'Awards.RecommendationFeedbackRequested'
- EVENT_FEEDBACK_RETRACTED : mixed = 'Awards.RecommendationFeedbackRetracted'
- EVENT_FEEDBACK_RETURNED : mixed = 'Awards.RecommendationFeedbackReturned'
Properties
- $itemsTable : Table
- $notesTable : Table
- $recipientsTable : Table
- $recommendationsTable : Table
- $requestsTable : Table
- $triggerDispatcher : TriggerDispatcher|null
- $workflowApprovalResponsesTable : Table
- $workflowApprovalsTable : Table
Methods
- __construct() : mixed
- Load tables used by the feedback lifecycle.
- createRequests() : ServiceResult
- Create one feedback request per selected recommendation or recommendation group.
- expireFeedbackForApproval() : ServiceResult
- Mark the feedback recipient linked to an expired workflow approval as expired.
- recordFeedbackFromApproval() : ServiceResult
- Mark feedback returned from a workflow approval response.
- retractRequest() : ServiceResult
- Retract pending feedback recipients for a request.
- buildRequestUnits() : array<int, array<int, Recommendation>>
- buildSnapshot() : array<string|int, mixed>
- Build the safe recipient-visible recommendation snapshot.
- buildWorkflowEventPayload() : array<string, mixed>
- Build workflow trigger context for one feedback recipient activity.
- createFeedbackNote() : void
- Mirror returned feedback into recommendation notes for owner visibility.
- dispatchWorkflowEvents() : void
- Dispatch feedback workflow trigger events inside the surrounding write transaction.
- formatFeedbackNoteBody() : string
- Format the note body mirrored back to each award recommendation.
- hasOpenRequest() : bool
- normalizeIds() : array<string|int, int>
- refreshRequestStatus() : void
- Resolve the request after all recipients have responded, expired, or been retracted.
Constants
EVENT_FEEDBACK_EXPIRED
public
mixed
EVENT_FEEDBACK_EXPIRED
= 'Awards.RecommendationFeedbackExpired'
EVENT_FEEDBACK_REQUESTED
public
mixed
EVENT_FEEDBACK_REQUESTED
= 'Awards.RecommendationFeedbackRequested'
EVENT_FEEDBACK_RETRACTED
public
mixed
EVENT_FEEDBACK_RETRACTED
= 'Awards.RecommendationFeedbackRetracted'
EVENT_FEEDBACK_RETURNED
public
mixed
EVENT_FEEDBACK_RETURNED
= 'Awards.RecommendationFeedbackReturned'
Properties
$itemsTable
private
Table
$itemsTable
$notesTable
private
Table
$notesTable
$recipientsTable
private
Table
$recipientsTable
$recommendationsTable
private
Table
$recommendationsTable
$requestsTable
private
Table
$requestsTable
$triggerDispatcher
private
TriggerDispatcher|null
$triggerDispatcher
$workflowApprovalResponsesTable
private
Table
$workflowApprovalResponsesTable
$workflowApprovalsTable
private
Table
$workflowApprovalsTable
Methods
__construct()
Load tables used by the feedback lifecycle.
public
__construct([TriggerDispatcher|null $triggerDispatcher = null ]) : mixed
Parameters
- $triggerDispatcher : TriggerDispatcher|null = null
createRequests()
Create one feedback request per selected recommendation or recommendation group.
public
createRequests(array<string|int, int|string> $recommendationIds, array<string|int, int|string> $recipientIds, int $requesterId[, string|null $message = null ][, string|null $deadline = null ]) : ServiceResult
Parameters
- $recommendationIds : array<string|int, int|string>
-
Selected recommendation IDs.
- $recipientIds : array<string|int, int|string>
-
Selected recipient member IDs.
- $requesterId : int
-
Noble/request owner member ID.
- $message : string|null = null
-
Optional request instructions.
- $deadline : string|null = null
-
Optional date/time string.
Return values
ServiceResultexpireFeedbackForApproval()
Mark the feedback recipient linked to an expired workflow approval as expired.
public
expireFeedbackForApproval(int $approvalId[, DateTime|null $expiredAt = null ]) : ServiceResult
Parameters
- $approvalId : int
- $expiredAt : DateTime|null = null
Return values
ServiceResultrecordFeedbackFromApproval()
Mark feedback returned from a workflow approval response.
public
recordFeedbackFromApproval(int $approvalId, int $memberId[, string|null $comment = null ]) : ServiceResult
Parameters
- $approvalId : int
- $memberId : int
- $comment : string|null = null
Return values
ServiceResultretractRequest()
Retract pending feedback recipients for a request.
public
retractRequest(int $requestId, int $actorId[, bool $adminOverride = false ]) : ServiceResult
Parameters
- $requestId : int
- $actorId : int
- $adminOverride : bool = false
Return values
ServiceResultbuildRequestUnits()
private
buildRequestUnits(array<string|int, int> $recommendationIds) : array<int, array<int, Recommendation>>
Parameters
- $recommendationIds : array<string|int, int>
Return values
array<int, array<int, Recommendation>>buildSnapshot()
Build the safe recipient-visible recommendation snapshot.
private
buildSnapshot(Recommendation $recommendation) : array<string|int, mixed>
Parameters
- $recommendation : Recommendation
Return values
array<string|int, mixed>buildWorkflowEventPayload()
Build workflow trigger context for one feedback recipient activity.
private
buildWorkflowEventPayload(int $recipientRowId[, array<string, mixed> $extra = [] ]) : array<string, mixed>
Parameters
- $recipientRowId : int
- $extra : array<string, mixed> = []
-
Additional event-specific context
Return values
array<string, mixed>createFeedbackNote()
Mirror returned feedback into recommendation notes for owner visibility.
private
createFeedbackNote(int $recommendationId, int $authorId, int $requestId, string $body) : void
Parameters
- $recommendationId : int
- $authorId : int
- $requestId : int
- $body : string
dispatchWorkflowEvents()
Dispatch feedback workflow trigger events inside the surrounding write transaction.
private
dispatchWorkflowEvents(array<int, array{eventName: string, eventData: array, triggeredBy: int|null}> $events) : void
Parameters
-
$events
: array<int, array{eventName: string, eventData: array
, triggeredBy: int|null}>
formatFeedbackNoteBody()
Format the note body mirrored back to each award recommendation.
private
formatFeedbackNoteBody(string $comment, string|null $answerLabel) : string
Parameters
- $comment : string
- $answerLabel : string|null
Return values
stringhasOpenRequest()
private
hasOpenRequest(array<string|int, int> $recommendationIds, int $recipientId) : bool
Parameters
- $recommendationIds : array<string|int, int>
- $recipientId : int
Return values
boolnormalizeIds()
private
normalizeIds(array<string|int, int|string> $ids) : array<string|int, int>
Parameters
- $ids : array<string|int, int|string>
Return values
array<string|int, int>refreshRequestStatus()
Resolve the request after all recipients have responded, expired, or been retracted.
private
refreshRequestStatus(int $requestId[, DateTime|null $resolvedAt = null ]) : void
Parameters
- $requestId : int
- $resolvedAt : DateTime|null = null