Esempio n. 1
0
 public function prePersist(Chapter $chapter, LifecycleEventArgs $event)
 {
     if ($chapter->getText() != null) {
         $userPicker = new UserPickerContent($chapter->getText());
         $chapter->setUserPicker($userPicker);
         $chapter->setText($userPicker->getFinalText());
     }
 }
Esempio n. 2
0
 /**
  * Copy chapter_org subchapters into provided chapter_copy
  * @param Chapter $chapter_org
  * @param Chapter $parent
  * @param boolean $copy_children
  * @param Lesson $copyName
  *
  * @return Chapter $chapter_copy
  */
 public function copyChapter(Chapter $chapter_org, Chapter $parent, $copy_children, $copyName = null)
 {
     $chapter_copy = new Chapter();
     if (!$copyName) {
         $copyName = $chapter_org->getTitle();
     }
     $chapter_copy->setTitle($copyName);
     $chapter_copy->setText($chapter_org->getText());
     $chapter_copy->setLesson($parent->getLesson());
     $this->insertChapter($chapter_copy, $parent);
     if ($copy_children) {
         $this->copyChildren($chapter_org, $chapter_copy, $copy_children);
     }
     return $chapter_copy;
 }