KMP PHP API Reference

RunMigrateAwardEvents extends BaseMigration
in package

Migration to execute Award Events to Gatherings data migration

Table of Contents

Methods

down()  : void
Indicates that this migration does not support rollback.
up()  : void
Orchestrates the migration that converts Award Events into Gatherings and updates related references.
associateAwardsWithActivity()  : void
Ensure every Award is associated with the given gathering activity.
createGatheringsFromAwardEvents()  : array<int, int>
Create Gatherings from every award Event and associate them with a gathering activity.
createKingdomCalendarEventType()  : EntityInterface
Ensures a GatheringTypes record named "Kingdom Calendar Event" exists and returns it.
createKingdomCourtActivity()  : EntityInterface
Ensure a "Kingdom Court" gathering activity exists, creating it if missing.
updateAwardRecommendations()  : void
Update award recommendations to reference newly created gatherings for mapped events.

Methods

up()

Orchestrates the migration that converts Award Events into Gatherings and updates related references.

public up() : void

Ensures a "Kingdom Court" gathering activity and a "Kingdom Calendar Event" gathering type exist, associates all awards with the activity, creates Gatherings for each Award Event (linking them to the activity and gathering type), and updates Award Recommendations to reference the newly created Gatherings.

associateAwardsWithActivity()

Ensure every Award is associated with the given gathering activity.

protected associateAwardsWithActivity(int $activityId) : void

Creates missing AwardGatheringActivities junction records that link each Award to the specified gathering activity.

Parameters
$activityId : int

ID of the gathering activity to associate with each award.

createGatheringsFromAwardEvents()

Create Gatherings from every award Event and associate them with a gathering activity.

protected createGatheringsFromAwardEvents(int $gatheringTypeId, int $activityId) : array<int, int>

Creates a Gathering for each record in Awards.Events using the provided gathering type, links each created Gathering to the specified activity, and returns a mapping from award event IDs to the newly created gathering IDs.

Parameters
$gatheringTypeId : int

The gathering type ID to assign to created Gatherings.

$activityId : int

The gathering activity ID to associate each created Gathering with.

Return values
array<int, int>

Map where keys are award event IDs and values are the corresponding created gathering IDs.

createKingdomCalendarEventType()

Ensures a GatheringTypes record named "Kingdom Calendar Event" exists and returns it.

protected createKingdomCalendarEventType() : EntityInterface

If the record does not exist, creates one with name "Kingdom Calendar Event" and description "Official Kingdom calendar events" and returns the newly created entity.

Return values
EntityInterface

The existing or newly created gathering type entity.

createKingdomCourtActivity()

Ensure a "Kingdom Court" gathering activity exists, creating it if missing.

protected createKingdomCourtActivity() : EntityInterface
Return values
EntityInterface

The GatheringActivity entity representing "Kingdom Court".

updateAwardRecommendations()

Update award recommendations to reference newly created gatherings for mapped events.

protected updateAwardRecommendations(array<string|int, int> $eventGatheringMap) : void

For each recommendation that has an event_id, sets its gathering_id to the corresponding gathering ID from the provided map when a mapping exists.

Parameters
$eventGatheringMap : array<string|int, int>

Map of event IDs to gathering IDs (keys are event IDs, values are gathering IDs).


        
On this page

Search results