KMP PHP API Reference

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

Properties

Methods

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
ServiceResult

expireFeedbackForApproval()

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
ServiceResult

recordFeedbackFromApproval()

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
ServiceResult

retractRequest()

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
ServiceResult

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
string

hasOpenRequest()

private hasOpenRequest(array<string|int, int> $recommendationIds, int $recipientId) : bool
Parameters
$recommendationIds : array<string|int, int>
$recipientId : int
Return values
bool

normalizeIds()

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
On this page

Search results