If the updated content is a user, update it using the user API, and return a Version object.

@param mixed $contentId
@param int $versionNumber
@param \Symfony\Component\HttpFoundation\Request $request

@return \eZ\Publish\Core\REST\Server\Values\Version
321013
public function updateVersion($contentId, $versionNumber, Request $request)
    {
        if (!$this->isUserContent($contentId)) {
            return parent::updateVersion($contentId, $versionNumber, $request);
        }

        $updatedUser = $this->repository->getUserService()->updateUser(
            $this->repository->getUserService()->loadUser($contentId),
            $this->mapRequestToUserUpdateStruct($request)
        );

        return $this->mapUserToVersion($updatedUser, $request);
    }
258629
public function changeRecordListing(Request $request, $contenttype, $contentid)
    {
        // We have to handle three cases here:
        // - $contenttype and $contentid given: get changelog entries for *one* content item
        // - only $contenttype given: get changelog entries for all items of that type
        // - neither given: get all changelog entries

        $page = $request->get('page');
        $pagination = $this->getPagination($page);
        $queryOptions = $this->getQueryOptions($pagination);

        if (empty($contenttype)) {
            // Case 1: No content type given, show from *all* items. This is easy:
            $data = [
                'title'   => Trans::__('logs.change-log.contenttypes.all'),
                'entries' => $this->changeLogRepository()->getChangeLog($queryOptions),
                'count'   => $this->changeLogRepository()->count(),
                'content' => null,
            ];
        } else {
            $contenttype = $this->getContentType($contenttype);
            $data = $this->manager()->getListingData($contenttype, $contentid, $queryOptions);
        }

        $context = [
            'contenttype' => $contenttype,
            'entry'       => null,
            'entries'     => $data['entries'],
            'content'     => $data['content'],
            'title'       => $data['title'],
            'currentpage' => $pagination['page'],
            'pagecount'   => $pagination['limit'] ? ceil($data['count'] / $pagination['limit']) : null,
        ];

        return $this->render('@bolt/changelog/changelog_record_all.twig', $context);
    }
373032
public function setStatus($contentId, $version, $status)
    {
        try {
            return $this->innerGateway->setStatus($contentId, $version, $status);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
512086
function cloneVersion( $newVersionNumber, $userID, $contentObjectID = false, $status = eZContentObjectVersion::STATUS_DRAFT )
    {
        $time = time();
        $clonedVersion = clone $this;
        $clonedVersion->setAttribute( 'id', null );
        if ( $contentObjectID !== false )
            $clonedVersion->setAttribute( 'contentobject_id', $contentObjectID );
        $clonedVersion->setAttribute( 'version', $newVersionNumber );
        $clonedVersion->setAttribute( 'created', $time );
        $clonedVersion->setAttribute( 'modified', $time );
        $clonedVersion->setAttribute( 'creator_id', $userID );
        if ( $status !== false )
            $clonedVersion->setAttribute( 'status', $status );
        return $clonedVersion;
    }
552082
public function apply($contentId)
    {
        $versionNumbers = $this->contentGateway->listVersionNumbers($contentId);
        $languageCodeToFieldId = array();

        $nameRows = $this->contentGateway->loadVersionedNameData(
            array_map(
                function ($versionNo) use ($contentId) {
                    return array('id' => $contentId, 'version' => $versionNo);
                },
                $versionNumbers
            )
        );

        foreach ($versionNumbers as $versionNo) {
            $contentRows = $this->contentGateway->load($contentId, $versionNo);
            $contentList = $this->contentMapper->extractContentFromRows($contentRows, $nameRows);
            $content = $contentList[0];
            $languageCodeSet = array();

            // Each subsequent Content version can have additional language(s)
            foreach ($content->fields as $field) {
                $languageCode = $field->languageCode;

                // Add once for each language per version
                if (isset($languageCodeSet[$languageCode])) {
                    continue;
                }

                $languageCodeSet[$languageCode] = true;

                // Check if field was already inserted for current language code,
                // in that case we need to preserve its ID across versions
                if (isset($languageCodeToFieldId[$languageCode])) {
                    $fieldId = $languageCodeToFieldId[$languageCode];
                } else {
                    $fieldId = null;
                }

                $languageCodeToFieldId[$languageCode] = $this->insertField(
                    $content,
                    $this->createField(
                        $fieldId,
                        $versionNo,
                        $languageCode
                    )
                );
            }
        }
    }
400474
public function searchAction(Request $request, $contentId)
    {
        $this->denyAccessUnlessGranted('ez:infocollector:read');

        $content = $this->contentService->loadContent($contentId);

        $query = new Query([
            'contentId' => $contentId,
            'searchText' => $request->query->get('searchText'),
        ]);
        $adapter = new InformationCollectionCollectionListSearchAdapter($this->service, $query);
        $pager = $this->getPager($adapter, (int)$request->query->get('page'));

        return $this->render("NetgenInformationCollectionBundle:admin:collection_list.html.twig",
            [
                'objects' => $pager,
                'content' => $content,
            ]
        );
    }
825679
public function updateAction(Request $request, ContentNode $contentNode, $isSimpleForm = false)
    {
        $em = $this->getDoctrine()->getManager();
        $repository = $this->getDoctrine()->getRepository('MMCmfNodeBundle:Node');

        $rootNode = null;

        if ((int)$request->get('root_node')) {
            $rootNode = $repository->find((int)$request->get('root_node'));
        }

        //check if node need "simple" validation
        if ($isSimpleForm)
            $editForm = $this->createSimpleEditForm($contentNode, $rootNode);
        else
            $editForm = $this->createEditForm($contentNode, $rootNode);

        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            $markup = $this->get('mm_cmf_content.mm_cmf_parse_twig_extension')->cmfParse(
                $this->get('twig'),
                $contentNode
            );
            return new JsonResponse(array(
                    'success' => true,
                    'data' => array(
                        'id' => $contentNode->getId(),
                        'markup' => $markup
                    ))
            );
        }

        return new JsonResponse(array('success' => false));
    }
823023
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerBrandVersionQuery::create()
            ->filterByDealerBrand($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
851814
public function getLastVersionNumber($contentId)
    {
        try {
            return $this->innerGateway->getLastVersionNumber($contentId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
541845
public function deleteTranslatedFields($languageCode, $contentId, $versionNo = null)
    {
        $query = $this->connection->createQueryBuilder();
        $query
            ->delete('ezcontentobject_attribute')
            ->where('contentobject_id = :contentId')
            ->andWhere('language_code = :languageCode')
            ->setParameters(
                [
                    ':contentId' => $contentId,
                    ':languageCode' => $languageCode,
                ]
            )
        ;

        if (null !== $versionNo) {
            $query
                ->andWhere('version = :versionNo')
                ->setParameter(':versionNo', $versionNo)
            ;
        }

        $query->execute();
    }
1207089
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerContentVersionQuery::create()
            ->filterByDealerContent($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
1167483
public function deleteTranslationFromContentFields($contentId, array $versions, $languageCode)
    {
        foreach ($versions as $versionInfo) {
            // FT-specific implementations require VersionInfo to delete data
            $fieldTypeIdsMap = $this->contentGateway->getFieldIdsByType(
                $versionInfo->contentInfo->id,
                $versionInfo->versionNo,
                $languageCode
            );

            foreach ($fieldTypeIdsMap as $fieldType => $ids) {
                $this->storageHandler->deleteFieldData($fieldType, $versionInfo, $ids);
            }
        }

        $this->contentGateway->deleteTranslatedFields($languageCode, $contentId);
    }
352121
public function getTrainingInputsByVersion(string $modelId, string $versionId)
    {
        $inputResult = $this->getRequest()->request(
            'GET',
            $this->getRequestUrl(sprintf('models/%s/versions/%s/inputs', $modelId, $versionId))
        );

        return $this->getInputsFromResult($inputResult);
    }
876466
public function createDraftFromVersion($contentId, $versionNumber)
    {
        $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
        $contentType = $this->repository->getContentTypeService()->loadContentType($contentInfo->contentTypeId);
        $contentDraft = $this->repository->getContentService()->createContentDraft(
            $contentInfo,
            $this->repository->getContentService()->loadVersionInfo($contentInfo, $versionNumber)
        );

        return new Values\CreatedVersion(
            array(
                'version' => new Values\Version(
                    $contentDraft,
                    $contentType,
                    $this->repository->getContentService()->loadRelations($contentDraft->getVersionInfo())
                ),
            )
        );
    }
777089
public function getContentName($contentId): string
    {
        try {
            $versionInfo = $this->loadVersionInfo($contentId);

            return $versionInfo->getName() ?? '';
        } catch (Throwable $t) {
            return '';
        }
    }
1349691
public function getOneVersion($versionNumber, $con = null)
    {
        return ChildDealerContactVersionQuery::create()
            ->filterByDealerContact($this)
            ->filterByVersion($versionNumber)
            ->findOne($con);
    }
1212586
public function exportAction($contentId, Request $request)
    {
        $this->denyAccessUnlessGranted('ez:infocollector:read');

        $content = $this->contentService->loadContent($contentId);

        $form = $this->createForm(ExportType::class);
        $form->handleRequest($request);

        if ($form->get('cancel')->isClicked()) {
            return $this->redirect($this->generateUrl('netgen_information_collection.route.admin.collection_list', ['contentId' => $contentId]));
        }

        if ($form->isValid() && $form->get('export')->isClicked()) {

            $exportCriteria = new ExportCriteria(
                [
                    'content' => $content,
                    'from' => $form->getData()['dateFrom'],
                    'to' => $form->getData()['dateTo'],
                ]
            );

            $export = $this->exporter->export($exportCriteria);

            $writer = Writer::createFromFileObject(new SplTempFileObject());
            $writer->setDelimiter(",");
            $writer->setNewline("\r\n"); //use windows line endings for compatibility with some csv libraries
            $writer->setOutputBOM(Writer::BOM_UTF8); //adding the BOM sequence on output
            $writer->insertOne($export->header);
            $writer->insertAll($export->contents);

            $writer->output('export.csv');
            return new Response('');
        }

        return $this->render("@NetgenInformationCollection/admin/export_menu.html.twig",
            [
                'content' => $content,
                'form' => $form->createView(),
            ]
        );
    }