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
165327
public function publishVersion($contentId, $versionNumber)
    {
        if (!$this->isUserContent($contentId)) {
            parent::publishVersion($contentId, $versionNumber);
        }

        return new NoContent();
    }
1033629
public function newVersionContent(ContentInterface $originalContent, $versionName = '')
    {
        $newContent = $this->cloneContent($originalContent);
        $newContent->setVersionName($versionName);
        if (empty($versionName)) {
            $newContent = $this->setVersionName($newContent);
        }

        return $newContent;
    }
6771
public function deleteNodeAssignment($contentId, $versionNo = null)
    {
        try {
            return $this->innerGateway->deleteNodeAssignment($contentId, $versionNo);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
91279
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();
    }
219511
public function previewAction(
        Content $content,
        ?string $languageCode = null,
        ?int $versionNo = null,
        ?Location $location = null
    ): Response {
        if (null === $languageCode) {
            $languageCode = $content->contentInfo->mainLanguageCode;
        }

        // nonpublished content should use parent location instead because location doesn't exist yet
        if (!$content->contentInfo->published && null === $content->contentInfo->mainLocationId) {
            $versionInfo = $this->contentService->loadVersionInfo($content->contentInfo, $versionNo);
            $parentLocations = $this->locationService->loadParentLocationsForDraftContent($versionInfo);
            $location = reset($parentLocations);
            $versionNo = null;
        }

        if (null === $location) {
            $location = $this->locationService->loadLocation($content->contentInfo->mainLocationId);
        }

        $siteaccesses = $this->siteaccessResolver->getSiteaccessesForLocation($location, $versionNo, $languageCode);

        if (empty($siteaccesses)) {
            throw new BadStateException(
                'siteaccess',
                'There is no siteaccesses available for particular content'
            );
        }

        return $this->render('@ezdesign/content/content_preview.html.twig', [
            'location' => $location,
            'content' => $content,
            'language_code' => $languageCode,
            'siteaccesses' => $siteaccesses,
            'versionNo' => $versionNo ?? $content->getVersionInfo()->versionNo,
        ]);
    }
673018
public function loadContentVersions($contentId, Request $request)
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);

        return new Values\VersionList(
            $this->repository->getContentService()->loadVersions($contentInfo),
            $request->getPathInfo()
        );
    }
704547
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerShedulesVersionQuery::create()
            ->filterByDealerShedules($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
791049
static function removeById( $attributeId, $version = null )
    {
        if ( $version !== null )
    	   $conds = array( 'contentobject_attribute_id' => $attributeId, 'contentobject_version' => $version  );
    	else
    	    $conds = array( 'contentobject_attribute_id' => $attributeId );

        eZPersistentObject::removeObject( self::definition(), $conds, null );
    }
524309
protected function getContent($contentId)
    {
        $content = null;
        if (!is_null($contentId)) {
            $language = $this->currentSiteManager->getSiteLanguage();
            $content = $this->contentRepository->findPublishedVersion($contentId, $language);
        }

        if (is_null($content) && $this->requestStack->getMasterRequest()->get('token')) {
            $content = new FakeContent();
        }

        return $content;
    }
704052
public function deleteContent($contentId)
    {
        $this->repository->getContentService()->deleteContent(
            $this->repository->getContentService()->loadContentInfo($contentId)
        );

        return new Values\NoContent();
    }
957751
public function mapContent(VersionInfo $versionInfo, $languageCode)
    {
        $contentInfo = $versionInfo->contentInfo;

        return new Content(
            [
                'id' => $contentInfo->id,
                'mainLocationId' => $contentInfo->mainLocationId,
                'name' => $versionInfo->getName($languageCode),
                'languageCode' => $languageCode,
                'innerVersionInfo' => $versionInfo,
                'site' => $this->site,
                'domainObjectMapper' => $this,
                'repository' => $this->repository,
            ]
        );
    }
45848
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerProductVersionQuery::create()
            ->filterByDealerProduct($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
100493
public function redirectCurrentVersion($contentId)
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);

        return new Values\TemporaryRedirect(
            $this->router->generate(
                'ezpublish_rest_loadContentInVersion',
                array(
                    'contentId' => $contentId,
                    'versionNumber' => $contentInfo->currentVersionNo,
                )
            )
        );
    }
1207089
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerContentVersionQuery::create()
            ->filterByDealerContent($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
266916
public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds)
    {
        $query = $this->connection->createQueryBuilder();
        $query->delete('ngsyliusproduct')
            ->where(
                $query->expr()->eq('contentobject_id', ':contentobject_id')
            )
            ->setParameter('contentobject_id', $versionInfo->contentInfo->id, Type::INTEGER);

        $query->execute();
    }
1053735
public function delete($contentId)
    {
        $this->loadModel('Content.Contents');
        $content = $this->Contents->get($contentId, ['contain' => ['ContentTypes']]);

        if (!$content || empty($content->content_type)) {
            throw new ContentNotFoundException(__d('content', 'The requested page was not found.'));
        }

        if (!$content->content_type->userAllowed('translate')) {
            throw new ContentDeleteException(__d('content', 'You are not allowed to delete contents of this type ({0}).', $content->content_type->name));
        }

        if ($this->Contents->delete($content, ['atomic' => true])) {
            $this->Flash->success(__d('content', 'Content was successfully removed!'));
        } else {
            $this->Flash->danger(__d('content', 'Unable to remove this content, please try again.'));
        }

        $this->title(__d('content', 'Delete Content'));
        $this->redirect($this->referer());
    }
730343
protected function checkContent($contentId)
    {
        /** @var \eZ\Publish\API\Repository\Values\Content\Content $content */
        $content = $this->repository->sudo(
            function (Repository $repository) use ($contentId) {
                return $repository->getContentService()->loadContent($contentId);
            }
        );

        $this->checkContentPermissions($content);
    }