GatheringCloneService
in package
uses
LocatorAwareTrait
Deep-copies a gathering including its activities, staff, and schedule items.
Handles date-offset calculation so that cloned schedule items are shifted to align with the new gathering's start date.
Table of Contents
Methods
- buildSuccessMessage() : string
- Build a human-readable success message summarising what was cloned.
- cloneActivities() : int
- Clone activities from the source gathering into the new one, then back-fill any required template activities that are missing.
- cloneSchedule() : int
- Clone scheduled activities, shifting times by the offset between the original and new gathering start dates.
- cloneStaff() : int
- Clone staff members from the source gathering.
Methods
buildSuccessMessage()
Build a human-readable success message summarising what was cloned.
public
buildSuccessMessage(string $gatheringName, int $activities, int $staff, int $schedule) : string
Parameters
- $gatheringName : string
-
New gathering name
- $activities : int
-
Number of cloned activities
- $staff : int
-
Number of cloned staff
- $schedule : int
-
Number of cloned schedule items
Return values
string —Formatted success message
cloneActivities()
Clone activities from the source gathering into the new one, then back-fill any required template activities that are missing.
public
cloneActivities(Gathering $original, Gathering $newGathering) : int
Parameters
- $original : Gathering
-
Source gathering (with gathering_activities loaded)
- $newGathering : Gathering
-
Newly saved gathering
Return values
int —Number of activities cloned
cloneSchedule()
Clone scheduled activities, shifting times by the offset between the original and new gathering start dates.
public
cloneSchedule(Gathering $original, Gathering $newGathering) : int
Parameters
- $original : Gathering
-
Source gathering (with gathering_scheduled_activities loaded)
- $newGathering : Gathering
-
Newly saved gathering
Return values
int —Number of scheduled activities cloned
cloneStaff()
Clone staff members from the source gathering.
public
cloneStaff(Gathering $original, Gathering $newGathering) : int
Parameters
- $original : Gathering
-
Source gathering (with gathering_staff loaded)
- $newGathering : Gathering
-
Newly saved gathering
Return values
int —Number of staff members cloned