Created
November 23, 2015 19:52
-
-
Save slave2zeros/6662cde158662f001b65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RYANs-iMac:website rgallagher$ git diff | |
diff --git a/src/Eduguide/GoalBundle/Traits/Controller/GoalAuthoring.php b/src/Eduguide/GoalBundle/Traits/Controller/GoalAuthoring.php | |
index 95bc879..85ff3bb 100644 | |
--- a/src/Eduguide/GoalBundle/Traits/Controller/GoalAuthoring.php | |
+++ b/src/Eduguide/GoalBundle/Traits/Controller/GoalAuthoring.php | |
@@ -286,7 +286,25 @@ trait GoalAuthoring | |
$activityAssociation->setEntityId($entity->getId()); | |
$activityAssociation->setActivityEntity($entity); | |
- $newActivity = $clone ? clone $activity : $activity; | |
+ /* | |
+ * Activity::__clone() removes steps because we have an ActivityCloner service. | |
+ * That service works with ActivityAssociations. | |
+ * So here we need to do a bit more work. | |
+ */ | |
+ if ($clone) { | |
+ $steps = $activity->getSteps(); | |
+ $newActivity = clone $activity; | |
+ | |
+ /** @var Step $step */ | |
+ foreach ($steps as $step) { | |
+ $newStep = clone $step; | |
+ $newStep->setActivity($newActivity); | |
+ $newActivity->addStep($newStep); | |
+ } | |
+ } else { | |
+ $newActivity = $activity; | |
+ } | |
+ | |
$newActivity->setParent($activity); | |
$activityAssociation->setActivity($newActivity); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment