KMP PHP API Reference

AdHocBestowalService
in package
uses LocatorAwareTrait

Records ad-hoc bestowals that are not backed by award recommendations.

Table of Contents

Constants

EVENT_NAME  : mixed = 'Awards.BestowalCreated'

Properties

$bestowalsTable  : Table
$courtSlotService  : BestowalCourtSlotService
$membersTable  : Table
$todoMaterializationService  : BestowalTodoMaterializationService

Methods

__construct()  : mixed
record()  : array<string, mixed>
Create an ad-hoc bestowal in a single transaction.
failureResult()  : array<string, mixed>
materializeTodos()  : void
Materialize the bestowal's to-do checklist from its award's template.
normalizeAwardId()  : int|null
normalizeConfiguredSpecialties()  : array<int, string>
normalizeDateTime()  : DateTime|null
Normalize a datetime input to UTC storage format.
normalizeOptionalInt()  : int|null
normalizeOptionalString()  : string|null
Convert blank strings to null.
resolveMemberReference()  : array{success: bool, memberId: int|null, error: string|null}
resolveSpecialtyForAward()  : array{success: bool, specialty: string|null, error: string|null}
Resolve and validate an ad-hoc bestowal specialty for the selected award.

Constants

Properties

Methods

__construct()

public __construct([Table|null $bestowalsTable = null ][, Table|null $membersTable = null ][, BestowalCourtSlotService|null $courtSlotService = null ][, BestowalTodoMaterializationService|null $todoMaterializationService = null ]) : mixed
Parameters
$bestowalsTable : Table|null = null

Optional injected bestowals table.

$membersTable : Table|null = null

Optional injected members table.

$courtSlotService : BestowalCourtSlotService|null = null

Optional injected court slot service.

$todoMaterializationService : BestowalTodoMaterializationService|null = null

Optional to-do service.

record()

Create an ad-hoc bestowal in a single transaction.

public record(array<string, mixed> $data, int $actorId) : array<string, mixed>

Expected keys in $data: member_sca_name plus optional member_id/member_public_id, award_id, state. Optional keys: gathering_id, gathering_scheduled_activity_id, bestowed_at, note, and court fields.

Parameters
$data : array<string, mixed>

Ad-hoc input payload.

$actorId : int

Current user ID.

Return values
array<string, mixed>

failureResult()

private failureResult(string $error) : array<string, mixed>
Parameters
$error : string
Return values
array<string, mixed>

materializeTodos()

Materialize the bestowal's to-do checklist from its award's template.

private materializeTodos(Bestowal $bestowal) : void

Failures are logged but never abort the ad-hoc bestowal: the checklist is supplemental and can be re-materialized idempotently later.

Parameters
$bestowal : Bestowal

Saved bestowal entity.

normalizeAwardId()

private normalizeAwardId(mixed $awardId) : int|null
Parameters
$awardId : mixed

Raw award ID input.

Return values
int|null

normalizeConfiguredSpecialties()

private normalizeConfiguredSpecialties(mixed $specialties) : array<int, string>
Parameters
$specialties : mixed

Configured award specialty metadata.

Return values
array<int, string>

normalizeDateTime()

Normalize a datetime input to UTC storage format.

private normalizeDateTime(mixed $value) : DateTime|null
Parameters
$value : mixed

Datetime input.

Return values
DateTime|null

normalizeOptionalInt()

private normalizeOptionalInt(mixed $value) : int|null
Parameters
$value : mixed

Raw integer input.

Return values
int|null

normalizeOptionalString()

Convert blank strings to null.

private normalizeOptionalString(mixed $value) : string|null
Parameters
$value : mixed

Input value.

Return values
string|null

resolveMemberReference()

private resolveMemberReference(array<string, mixed> $data) : array{success: bool, memberId: int|null, error: string|null}
Parameters
$data : array<string, mixed>

Ad-hoc input payload.

Return values
array{success: bool, memberId: int|null, error: string|null}

resolveSpecialtyForAward()

Resolve and validate an ad-hoc bestowal specialty for the selected award.

private resolveSpecialtyForAward(int $awardId, mixed $rawSpecialty) : array{success: bool, specialty: string|null, error: string|null}
Parameters
$awardId : int

Selected award ID.

$rawSpecialty : mixed

Submitted specialty value.

Return values
array{success: bool, specialty: string|null, error: string|null}
On this page

Search results