public function publishVersion($contentId, $versionNumber)
    {
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
            $this->repository->getContentService()->loadContentInfo($contentId),
            $versionNumber
        );

        if (!$versionInfo->isDraft()) {
            throw new ForbiddenException('Only version in status DRAFT can be published');
        }

        $this->repository->getContentService()->publishVersion(
            $versionInfo
        );

        return new Values\NoContent();
    }
public function publishVersion($contentId, $versionNumber)
    {
        $versionInfo = $this->repository->getContentService()->loadVersionInfo(
            $this->repository->getContentService()->loadContentInfo($contentId),
            $versionNumber
        );

        if (!$versionInfo->isDraft()) {
            throw new ForbiddenException('Only version in status DRAFT can be published');
        }

        $this->repository->getContentService()->publishVersion(
            $versionInfo
        );

        return new Values\NoContent();
    }
public function publishVersion ( $ contentId , $ versionNumber ) { $ versionInfo = $ this -> repository -> getContentService ( ) -> loadVersionInfo ( $ this -> repository -> getContentService ( ) -> loadContentInfo ( $ contentId ) , $ versionNumber ) ; if ( ! $ versionInfo -> isDraft ( ) ) { throw new ForbiddenException ( 'Only version in status DRAFT can be published' ) ; } $ this -> repository -> getContentService ( ) -> publishVersion ( $ versionInfo ) ; return new Values \ NoContent ( ) ; }
The content version is published.

@param mixed $contentId
@param mixed $versionNumber

@throws ForbiddenException if version $versionNumber isn't a draft

@return \eZ\Publish\Core\REST\Server\Values\NoContent
The content version is published .