public function prepareCommitDraft()
    {
        if (null === $revision = $this->getDraft()) {
            throw new Exception\RevisionMissingException('Enable to commit: missing draft');
        }

        switch ($revision->getState()) {
            case Revision::STATE_ADDED:
            case Revision::STATE_MODIFIED:
                $revision->setRevision($revision->getRevision() + 1);
                $revision->setState(Revision::STATE_COMMITTED);

                $this->releaseDraft();

                $this->_label = $revision->getLabel();
                $this->_accept = $revision->getAccept();
                $this->_maxentry = $revision->getMaxEntry();
                $this->_minentry = $revision->getMinEntry();
                $this->_parameters = $revision->getAllParams();

                $this->setRevision($revision->getRevision())
                    ->setState(AbstractClassContent::STATE_NORMAL)
                    ->addRevision($revision)
                ;

                return $this;

            case Revision::STATE_CONFLICTED:
                throw new Exception\RevisionConflictedException('Content is in conflict, please resolve or revert it');
        }

        throw new Exception\RevisionUptodateException(sprintf('Content can not be commited (state : %s)', $revision->getState()));
    }
public function prepareCommitDraft()
    {
        if (null === $revision = $this->getDraft()) {
            throw new Exception\RevisionMissingException('Enable to commit: missing draft');
        }

        switch ($revision->getState()) {
            case Revision::STATE_ADDED:
            case Revision::STATE_MODIFIED:
                $revision->setRevision($revision->getRevision() + 1);
                $revision->setState(Revision::STATE_COMMITTED);

                $this->releaseDraft();

                $this->_label = $revision->getLabel();
                $this->_accept = $revision->getAccept();
                $this->_maxentry = $revision->getMaxEntry();
                $this->_minentry = $revision->getMinEntry();
                $this->_parameters = $revision->getAllParams();

                $this->setRevision($revision->getRevision())
                    ->setState(AbstractClassContent::STATE_NORMAL)
                    ->addRevision($revision)
                ;

                return $this;

            case Revision::STATE_CONFLICTED:
                throw new Exception\RevisionConflictedException('Content is in conflict, please resolve or revert it');
        }

        throw new Exception\RevisionUptodateException(sprintf('Content can not be commited (state : %s)', $revision->getState()));
    }
public function prepareCommitDraft ( ) { if ( null === $ revision = $ this -> getDraft ( ) ) { throw new Exception \ RevisionMissingException ( 'Enable to commit: missing draft' ) ; } switch ( $ revision -> getState ( ) ) { case Revision :: STATE_ADDED : case Revision :: STATE_MODIFIED : $ revision -> setRevision ( $ revision -> getRevision ( ) + 1 ) ; $ revision -> setState ( Revision :: STATE_COMMITTED ) ; $ this -> releaseDraft ( ) ; $ this -> _label = $ revision -> getLabel ( ) ; $ this -> _accept = $ revision -> getAccept ( ) ; $ this -> _maxentry = $ revision -> getMaxEntry ( ) ; $ this -> _minentry = $ revision -> getMinEntry ( ) ; $ this -> _parameters = $ revision -> getAllParams ( ) ; $ this -> setRevision ( $ revision -> getRevision ( ) ) -> setState ( AbstractClassContent :: STATE_NORMAL ) -> addRevision ( $ revision ) ; return $ this ; case Revision :: STATE_CONFLICTED : throw new Exception \ RevisionConflictedException ( 'Content is in conflict, please resolve or revert it' ) ; } throw new Exception \ RevisionUptodateException ( sprintf ( 'Content can not be commited (state : %s)' , $ revision -> getState ( ) ) ) ; }
Prepares to commit an user's draft data for current content.

@return \BackBee\ClassContent\AbstractClassContent                         the current instance
@throws \BackBee\ClassContent\Exception\RevisionMissingException    Occurs if none draft is defined
@throws \BackBee\ClassContent\Exception\RevisionConflictedException Occurs if the revision is conlicted
@throws \BackBee\ClassContent\Exception\RevisionUptodateException   Occurs if the revision is already up to date
Prepares to commit an user s draft data for current content .