public function duplicate(Page $page, $title = null, Page $parent = null, $recursive = true, BBUserToken $token = null)
    {
        if (false === $recursive || false === $page->hasMainSection()) {
            $new_page = $this->copy($page, $title, $parent);
        } else {
            // Recursive cloning
            $new_page = $this->duplicateRecursively($page, $title, $parent);
        }

        // Finally updating contentset and mainnode
        foreach ($new_page->cloningData['contents'] as $content) {
            $this->updateRelatedPostCloning($content, $new_page->cloningData, $token)
                 ->updateMainNodePostCloning($content, $new_page->cloningData['pages'], $token)
            ;
        }

        return $new_page;
    }
public function duplicate(Page $page, $title = null, Page $parent = null, $recursive = true, BBUserToken $token = null)
    {
        if (false === $recursive || false === $page->hasMainSection()) {
            $new_page = $this->copy($page, $title, $parent);
        } else {
            // Recursive cloning
            $new_page = $this->duplicateRecursively($page, $title, $parent);
        }

        // Finally updating contentset and mainnode
        foreach ($new_page->cloningData['contents'] as $content) {
            $this->updateRelatedPostCloning($content, $new_page->cloningData, $token)
                 ->updateMainNodePostCloning($content, $new_page->cloningData['pages'], $token)
            ;
        }

        return $new_page;
    }
public function duplicate ( Page $ page , $ title = null , Page $ parent = null , $ recursive = true , BBUserToken $ token = null ) { if ( false === $ recursive || false === $ page -> hasMainSection ( ) ) { $ new_page = $ this -> copy ( $ page , $ title , $ parent ) ; } else { // Recursive cloning $ new_page = $ this -> duplicateRecursively ( $ page , $ title , $ parent ) ; } // Finally updating contentset and mainnode foreach ( $ new_page -> cloningData [ 'contents' ] as $ content ) { $ this -> updateRelatedPostCloning ( $ content , $ new_page -> cloningData , $ token ) -> updateMainNodePostCloning ( $ content , $ new_page -> cloningData [ 'pages' ] , $ token ) ; } return $ new_page ; }
Duplicate a page and optionnaly its descendants.

@param  Page                 $page               The page to be duplicated.
@param  string|null          $title              Optional, the title of the copy, if null (default) the title of the copied page.
@param  Page|null            $parent             Optional, the parent of the copy, if null (default) the parent of the copied page.
@param  boolean              $recursive          Optional, if true (by default) duplicates recursively the descendants of the page.
@param  BBUserToken|null     $token              Optional, the BBuser token to allow the update of revisions if set.

@return Page                                     The copy of the page.

@throws InvalidArgumentException                 Raises if the page is recursively duplicated in itself.
Duplicate a page and optionnaly its descendants .