MigrateAwardEventsCommand
extends Command
in package
Migrate Award Events Command
Migrates legacy Award Events to the new Gatherings system with the following steps:
- Create a "Kingdom Court" gathering activity
- Associate all awards with the "Kingdom Court" activity
- Create a "Kingdom Calendar Event" gathering type
- Create gatherings for each award event
- Add "Kingdom Court" activity to each new gathering
- Update award recommendations to reference gatherings instead of events
Usage: bin/cake migrate_award_events bin/cake migrate_award_events --dry-run
Table of Contents
Properties
Methods
- execute() : int|null
- Execute the command
- associateAwardsWithActivity() : void
- Step 2: Associate all awards with Kingdom Court activity
- buildOptionParser() : ConsoleOptionParser
- Hook method for defining this command's option parser.
- createGatheringsFromAwardEvents() : array<string|int, mixed>
- Steps 4-5: Create gatherings from award events and add Kingdom Court activity
- createKingdomCalendarEventType() : GatheringType|null
- Step 3: Create Kingdom Calendar Event gathering type
- createKingdomCourtActivity() : GatheringActivity|null
- Step 1: Create Kingdom Court gathering activity
- updateAwardRecommendations() : void
- Steps 6-7: Update award recommendations to reference gatherings
Properties
$dryRun
protected
bool
$dryRun
= false
$io
protected
ConsoleIo
$io
Methods
execute()
Execute the command
public
execute(Arguments $args, ConsoleIo $io) : int|null
Parameters
- $args : Arguments
-
The command arguments.
- $io : ConsoleIo
-
The console io
Return values
int|null —The exit code or null for success
associateAwardsWithActivity()
Step 2: Associate all awards with Kingdom Court activity
protected
associateAwardsWithActivity(int $activityId) : void
Parameters
- $activityId : int
-
The Kingdom Court activity ID
buildOptionParser()
Hook method for defining this command's option parser.
protected
buildOptionParser(ConsoleOptionParser $parser) : ConsoleOptionParser
Parameters
- $parser : ConsoleOptionParser
-
The parser to be defined
Return values
ConsoleOptionParsercreateGatheringsFromAwardEvents()
Steps 4-5: Create gatherings from award events and add Kingdom Court activity
protected
createGatheringsFromAwardEvents(int $gatheringTypeId, int $activityId) : array<string|int, mixed>
Parameters
- $gatheringTypeId : int
-
The gathering type ID
- $activityId : int
-
The Kingdom Court activity ID
Return values
array<string|int, mixed> —Map of event_id => gathering_id
createKingdomCalendarEventType()
Step 3: Create Kingdom Calendar Event gathering type
protected
createKingdomCalendarEventType() : GatheringType|null
Return values
GatheringType|nullcreateKingdomCourtActivity()
Step 1: Create Kingdom Court gathering activity
protected
createKingdomCourtActivity() : GatheringActivity|null
Return values
GatheringActivity|nullupdateAwardRecommendations()
Steps 6-7: Update award recommendations to reference gatherings
protected
updateAwardRecommendations(array<string|int, mixed> $eventGatheringMap) : void
Parameters
- $eventGatheringMap : array<string|int, mixed>
-
Map of event_id => gathering_id