BestowalRecommendationLinkService
in package
uses
BestowalNotesSupportTrait, LocatorAwareTrait
Links and unlinks recommendations on an existing bestowal.
Table of Contents
Properties
- $approvalLifecycleService : RecommendationApprovalWorkflowLifecycleService
- $bestowalRecommendationsTable : Table
- $bestowalsTable : Table
- $recommendationsTable : Table
- $syncService : BestowalRecommendationSyncService
Methods
- __construct() : mixed
- assertMinimumLinkedRecommendations() : void
- Ensure link/unlink changes leave at least one recommendation on the bestowal.
- getLinkedRecommendationIds() : array<string|int, int>
- linkRecommendations() : array<string|int, int>
- Link recommendations to a bestowal and sync bestowal-owned projections.
- unlinkRecommendations() : array<string|int, int>
- Unlink recommendations from bestowal ownership.
- buildHeraldNotes() : string|null
- Build herald-oriented call text from linked recommendations.
- buildNobleNotes() : string|null
- Summarize recommendation reasons for crown-facing notes.
- buildReasonSummary() : string|null
- Build a persisted summary of linked recommendation reasons and submitters.
- buildSpecialtySummary() : string|null
- Build the bestowal specialty from unique linked recommendation specialties.
- formatAwardLabel() : string
- Format an award label with optional level for note text.
- formatBestowalAwardLabel() : string
- Format the award selected on a bestowal for note and notification text.
- assertLinkable() : void
- isLinkedRecommendation() : bool
- refreshBestowalAfterLinkChange() : void
- Rebuild notes and primary recommendation after link changes.
- syncLinkedRecommendation() : bool
Properties
$approvalLifecycleService
private
RecommendationApprovalWorkflowLifecycleService
$approvalLifecycleService
$bestowalRecommendationsTable
private
Table
$bestowalRecommendationsTable
$bestowalsTable
private
Table
$bestowalsTable
$recommendationsTable
private
Table
$recommendationsTable
$syncService
private
BestowalRecommendationSyncService
$syncService
Methods
__construct()
public
__construct([Table|null $bestowalsTable = null ][, Table|null $recommendationsTable = null ][, Table|null $bestowalRecommendationsTable = null ][, BestowalRecommendationSyncService|null $syncService = null ][, RecommendationApprovalWorkflowLifecycleService|null $approvalLifecycleService = null ]) : mixed
Parameters
- $bestowalsTable : Table|null = null
-
Optional injected bestowals table.
- $recommendationsTable : Table|null = null
-
Optional injected recommendations table.
- $bestowalRecommendationsTable : Table|null = null
-
Optional injected join table.
- $syncService : BestowalRecommendationSyncService|null = null
-
Optional injected sync service.
- $approvalLifecycleService : RecommendationApprovalWorkflowLifecycleService|null = null
-
Optional approval lifecycle service.
assertMinimumLinkedRecommendations()
Ensure link/unlink changes leave at least one recommendation on the bestowal.
public
assertMinimumLinkedRecommendations(int $bestowalId, array<string|int, int> $unlinkIds, array<string|int, int> $linkIds) : void
Parameters
- $bestowalId : int
-
Bestowal ID.
- $unlinkIds : array<string|int, int>
-
Recommendation IDs to unlink.
- $linkIds : array<string|int, int>
-
Recommendation IDs to link.
getLinkedRecommendationIds()
public
getLinkedRecommendationIds(int $bestowalId) : array<string|int, int>
Parameters
- $bestowalId : int
-
Bestowal ID.
Return values
array<string|int, int>linkRecommendations()
Link recommendations to a bestowal and sync bestowal-owned projections.
public
linkRecommendations(int $bestowalId, array<string|int, int> $recommendationIds, int $actorId) : array<string|int, int>
Parameters
- $bestowalId : int
-
Bestowal ID.
- $recommendationIds : array<string|int, int>
-
Recommendation IDs to link.
- $actorId : int
-
Actor performing the change.
Return values
array<string|int, int> —Linked recommendation IDs.
unlinkRecommendations()
Unlink recommendations from bestowal ownership.
public
unlinkRecommendations(int $bestowalId, array<string|int, int> $recommendationIds, int $actorId) : array<string|int, int>
Parameters
- $bestowalId : int
-
Bestowal ID.
- $recommendationIds : array<string|int, int>
-
Recommendation IDs to unlink.
- $actorId : int
-
Actor performing the change.
Return values
array<string|int, int> —Unlinked recommendation IDs.
buildHeraldNotes()
Build herald-oriented call text from linked recommendations.
protected
buildHeraldNotes(array<int, Recommendation> $recommendations, string $memberScaName) : string|null
Parameters
- $recommendations : array<int, Recommendation>
-
Linked recommendations.
- $memberScaName : string
-
Recipient SCA name.
Return values
string|nullbuildNobleNotes()
Summarize recommendation reasons for crown-facing notes.
protected
buildNobleNotes(array<int, Recommendation> $recommendations) : string|null
Parameters
- $recommendations : array<int, Recommendation>
-
Linked recommendations.
Return values
string|nullbuildReasonSummary()
Build a persisted summary of linked recommendation reasons and submitters.
protected
buildReasonSummary(array<int, Recommendation> $recommendations) : string|null
Parameters
- $recommendations : array<int, Recommendation>
-
Linked recommendations.
Return values
string|nullbuildSpecialtySummary()
Build the bestowal specialty from unique linked recommendation specialties.
protected
buildSpecialtySummary(array<int, Recommendation> $recommendations) : string|null
Parameters
- $recommendations : array<int, Recommendation>
-
Linked recommendations.
Return values
string|nullformatAwardLabel()
Format an award label with optional level for note text.
protected
formatAwardLabel(Recommendation $recommendation) : string
Parameters
- $recommendation : Recommendation
-
Recommendation with optional award contain.
Return values
stringformatBestowalAwardLabel()
Format the award selected on a bestowal for note and notification text.
protected
formatBestowalAwardLabel(Bestowal $bestowal) : string
Parameters
- $bestowal : Bestowal
-
Bestowal with optional award contain.
Return values
stringassertLinkable()
private
assertLinkable(Bestowal $bestowal, Recommendation $recommendation) : void
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
- $recommendation : Recommendation
-
Recommendation to link.
isLinkedRecommendation()
private
isLinkedRecommendation(Bestowal $bestowal, int $recommendationId) : bool
Parameters
- $bestowal : Bestowal
-
Bestowal with recommendations contain.
- $recommendationId : int
-
Recommendation ID.
Return values
boolrefreshBestowalAfterLinkChange()
Rebuild notes and primary recommendation after link changes.
private
refreshBestowalAfterLinkChange(Bestowal $bestowal, int $actorId) : void
Parameters
- $bestowal : Bestowal
-
Bestowal entity (may be stale contain).
- $actorId : int
-
Actor performing the change.
syncLinkedRecommendation()
private
syncLinkedRecommendation(Bestowal $bestowal, Recommendation $recommendation, int $actorId) : bool
Parameters
- $bestowal : Bestowal
-
Bestowal entity.
- $recommendation : Recommendation
-
Recommendation to sync with the bestowal.
- $actorId : int
-
Actor performing the link.
Return values
bool —True when persisted recommendation fields were repaired.