private function updateMainNodePostCloning(AbstractClassContent $content, array $cloningPages, BBUserToken $token = null)
    {
        $mainnode = $content->getMainNode();

        if (
                null !== $mainnode &&
                0 < count($cloningPages) &&
                true === in_array($mainnode->getUid(), array_keys($cloningPages))
            ) {
            // Loading draft for content
            if (
                    null !== $token &&
                    (null !== $draft = $this->_em->getRepository('BackBee\ClassContent\Revision')->getDraft($content, $token, true))
                ) {
                $content->setDraft($draft);
            }
            $content->setMainNode($cloningPages[$mainnode->getUid()]);
        }

        return $this;
    }
private function updateMainNodePostCloning(AbstractClassContent $content, array $cloningPages, BBUserToken $token = null)
    {
        $mainnode = $content->getMainNode();

        if (
                null !== $mainnode &&
                0 < count($cloningPages) &&
                true === in_array($mainnode->getUid(), array_keys($cloningPages))
            ) {
            // Loading draft for content
            if (
                    null !== $token &&
                    (null !== $draft = $this->_em->getRepository('BackBee\ClassContent\Revision')->getDraft($content, $token, true))
                ) {
                $content->setDraft($draft);
            }
            $content->setMainNode($cloningPages[$mainnode->getUid()]);
        }

        return $this;
    }
private function updateMainNodePostCloning ( AbstractClassContent $ content , array $ cloningPages , BBUserToken $ token = null ) { $ mainnode = $ content -> getMainNode ( ) ; if ( null !== $ mainnode && 0 < count ( $ cloningPages ) && true === in_array ( $ mainnode -> getUid ( ) , array_keys ( $ cloningPages ) ) ) { // Loading draft for content if ( null !== $ token && ( null !== $ draft = $ this -> _em -> getRepository ( 'BackBee\ClassContent\Revision' ) -> getDraft ( $ content , $ token , true ) ) ) { $ content -> setDraft ( $ draft ) ; } $ content -> setMainNode ( $ cloningPages [ $ mainnode -> getUid ( ) ] ) ; } return $ this ; }
Update mainnode of the content if need during clonage.

@param  AbstractClassContent $content            The cloned content.
@param  array                $cloningPages       The cloned pages array.
@param  BBUserToken|null     $token              Optional, the BBuser token to allow the update of revisions if set.

@return PageRepository
Update mainnode of the content if need during clonage .