KMP PHP API Reference

BestowalRecommendationSyncService
in package
uses LocatorAwareTrait

Synchronizes bestowal-owned recommendation projections from the bestowal lifecycle.

Table of Contents

Properties

$bestowalsTable  : Table
$recommendationsTable  : Table

Methods

__construct()  : mixed
syncFromBestowal()  : array<string, mixed>
Sync linked recommendations to the mapped state for the bestowal's current state.
syncRecommendationGatheringFromBestowal()  : bool
Copy the bestowal gathering onto a linked recommendation when it differs.
syncRecommendationGivenFromBestowal()  : bool
Copy the bestowal bestowed date onto a linked recommendation's given date when it differs.
syncRecommendationLifecycleFromBestowal()  : bool
Advance a linked recommendation's status/state to match the bestowal lifecycle.
givenDatesMatch()  : bool
normalizeGivenDate()  : DateTime|null
resolveLinkedRecommendations()  : array<int, Recommendation>

Properties

Methods

__construct()

public __construct([Table|null $bestowalsTable = null ][, Table|null $recommendationsTable = null ]) : mixed
Parameters
$bestowalsTable : Table|null = null

Optional injected bestowals table.

$recommendationsTable : Table|null = null

Optional injected recommendations table.

syncFromBestowal()

Sync linked recommendations to the mapped state for the bestowal's current state.

public syncFromBestowal(int $bestowalId, int $actorId) : array<string, mixed>
Parameters
$bestowalId : int

Bestowal ID.

$actorId : int

Actor performing the sync.

Return values
array<string, mixed>

syncRecommendationGatheringFromBestowal()

Copy the bestowal gathering onto a linked recommendation when it differs.

public syncRecommendationGatheringFromBestowal(Bestowal $bestowal, Recommendation $recommendation, int $actorId) : bool
Parameters
$bestowal : Bestowal

Source bestowal.

$recommendation : Recommendation

Linked recommendation to update.

$actorId : int

Actor ID for audit logging.

Return values
bool

True when the recommendation gathering was updated.

syncRecommendationGivenFromBestowal()

Copy the bestowal bestowed date onto a linked recommendation's given date when it differs.

public syncRecommendationGivenFromBestowal(Bestowal $bestowal, Recommendation $recommendation, int $actorId) : bool
Parameters
$bestowal : Bestowal

Source bestowal.

$recommendation : Recommendation

Linked recommendation to update.

$actorId : int

Actor ID for audit logging.

Return values
bool

True when the recommendation given date was updated.

syncRecommendationLifecycleFromBestowal()

Advance a linked recommendation's status/state to match the bestowal lifecycle.

public syncRecommendationLifecycleFromBestowal(Bestowal $bestowal, Recommendation $recommendation, int $actorId) : bool

Once a recommendation is converted, the board state lives on the bestowal: an open bestowal without a gathering means "Scheduling / Need to Schedule", an open bestowal with a gathering means "To Give / Scheduled", and a given bestowal means "Closed / Given". Closed recommendations and the manual "Announced Not Given" board state are never overwritten by an open bestowal.

Parameters
$bestowal : Bestowal

Source bestowal.

$recommendation : Recommendation

Linked recommendation to update.

$actorId : int

Actor ID for audit logging.

Return values
bool

True when the recommendation status/state was updated.

givenDatesMatch()

private givenDatesMatch(DateTime|null $left, DateTime|null $right) : bool
Parameters
$left : DateTime|null

Normalized given date.

$right : DateTime|null

Normalized given date.

Return values
bool

normalizeGivenDate()

private normalizeGivenDate(DateTimeInterface|DateTime|null $value) : DateTime|null
Parameters
$value : DateTimeInterface|DateTime|null

Bestowed or given date.

Return values
DateTime|null
On this page

Search results