/**
  * @inheritdoc
  */
 public function postClone()
 {
     parent::postClone();
     // Copy shapes
     $newShapes = new ArrayCollection();
     foreach ($this->getShapes() as $shape) {
         $newShape = clone $shape;
         $newShape->setExercise($this);
         $newShapes->add($newShape);
     }
     $this->shapes = $newShapes;
     // copy the mainImage
     $tempMainImageCollection = new ArrayCollection();
     foreach ($this->getMainImageCollection() as $mainImageCollection) {
         $newMainImageCollection = clone $mainImageCollection;
         $newMainImageCollection->setExercise($this);
         $tempMainImageCollection->add($newMainImageCollection);
     }
     $this->mainImageCollection = $tempMainImageCollection;
 }
 /**
  * Implementation of clone magic method.
  */
 public function postClone()
 {
     // Clone common parent objects.
     parent::postClone();
     $tempQuestions = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($this->questions as $question) {
         $newQuestion = clone $question;
         $newQuestion->setExercise($this);
         $tempQuestions->add($newQuestion);
     }
     $this->questions = $tempQuestions;
 }
 /**
  * @inheritdoc
  */
 public function postClone()
 {
     parent::postClone();
     $phrases = new \Doctrine\Common\Collections\ArrayCollection();
     foreach ($this->phrases as $phrase) {
         $newPhrase = clone $phrase;
         $newPhrase->setExercise($this);
         $phrases->add($newPhrase);
     }
     $this->phrases = $phrases;
 }