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;
    }
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;
    }
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 ; }
Copy chapter_org subchapters into provided chapter_copy.

@param Chapter $chapter_org
@param Chapter $parent
@param bool    $copy_children
@param Lesson  $copyName

@return Chapter $chapter_copy
Copy chapter_org subchapters into provided chapter_copy .