public function publishVersion($contentId, $versionNumber) { $versionInfo = $this->repository->getContentService()->loadVersionInfo($this->repository->getContentService()->loadContentInfo($contentId), $versionNumber); if ($versionInfo->status !== VersionInfo::STATUS_DRAFT) { throw new ForbiddenException('Only version in status DRAFT can be published'); } $this->repository->getContentService()->publishVersion($versionInfo); return new Values\NoContent(); }
/** * If the published content is a user, return directly without publishing. * * @param mixed $contentId * @param int $versionNumber * * @return \eZ\Publish\Core\REST\Server\Values\NoContent */ public function publishVersion($contentId, $versionNumber) { if (!$this->isUserContent($contentId)) { parent::publishVersion($contentId, $versionNumber); } return new NoContent(); }