Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Publish/Core/REST/Server/Controller/Content.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\REST\Server\Controller;
8
9 use eZ\Publish\API\Repository\Values\Content\Language;
10 use eZ\Publish\Core\REST\Common\Message;
11 use eZ\Publish\Core\REST\Common\Exceptions;
12 use eZ\Publish\Core\REST\Server\Values;
13 use eZ\Publish\Core\REST\Server\Controller as RestController;
14 use eZ\Publish\API\Repository\Values\Content\Relation;
15 use eZ\Publish\API\Repository\Values\Content\VersionInfo;
16 use eZ\Publish\API\Repository\Exceptions\NotFoundException;
17 use eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException;
18 use eZ\Publish\API\Repository\Exceptions\ContentValidationException;
19 use eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException;
20 use eZ\Publish\Core\REST\Server\Exceptions\BadRequestException;
21 use eZ\Publish\Core\REST\Server\Exceptions\ContentFieldValidationException as RESTContentFieldValidationException;
22 use eZ\Publish\Core\REST\Server\Values\RestContentCreateStruct;
23 use Symfony\Component\HttpFoundation\Request;
24 use Symfony\Component\HttpKernel\HttpKernelInterface;
25
29 class Content extends RestController
30 {
38 public function redirectContent(Request $request)
39 {
40 if (!$request->query->has('remoteId')) {
41 throw new BadRequestException("'remoteId' parameter is required.");
42 }
43
44 $contentInfo = $this->repository->getContentService()->loadContentInfoByRemoteId(
45 $request->query->get('remoteId')
46 );
47
48 return new Values\TemporaryRedirect(
49 $this->router->generate(
50 'ezpublish_rest_loadContent',
51 [
52 'contentId' => $contentInfo->id,
53 ]
54 )
55 );
56 }
57
66 public function loadContent($contentId, Request $request)
67 {
68 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
69
70 $mainLocation = null;
71 if (!empty($contentInfo->mainLocationId)) {
72 $mainLocation = $this->repository->getLocationService()->loadLocation($contentInfo->mainLocationId);
73 }
74
75 $contentType = $this->repository->getContentTypeService()->loadContentType($contentInfo->contentTypeId);
76
77 $contentVersion = null;
78 $relations = null;
79 if ($this->getMediaType($request) === 'application/vnd.ez.api.content') {
80 $languages = Language::ALL;
81 if ($request->query->has('languages')) {
82 $languages = explode(',', $request->query->get('languages'));
83 }
84
85 $contentVersion = $this->repository->getContentService()->loadContent($contentId, $languages);
86 $relations = $this->repository->getContentService()->loadRelations($contentVersion->getVersionInfo());
87 }
88
89 $restContent = new Values\RestContent(
90 $contentInfo,
91 $mainLocation,
92 $contentVersion,
93 $contentType,
94 $relations,
95 $request->getPathInfo()
96 );
97
98 if ($contentInfo->mainLocationId === null) {
99 return $restContent;
100 }
101
102 return new Values\CachedValue(
103 $restContent,
104 ['locationId' => $contentInfo->mainLocationId]
105 );
106 }
107
115 public function updateContentMetadata($contentId, Request $request)
116 {
117 $updateStruct = $this->inputDispatcher->parse(
118 new Message(
119 ['Content-Type' => $request->headers->get('Content-Type')],
120 $request->getContent()
121 )
122 );
123
124 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
125
126 // update section
127 if ($updateStruct->sectionId !== null) {
128 $section = $this->repository->getSectionService()->loadSection($updateStruct->sectionId);
129 $this->repository->getSectionService()->assignSection($contentInfo, $section);
130 $updateStruct->sectionId = null;
131 }
132
133 // @todo Consider refactoring! ContentService::updateContentMetadata throws the same exception
134 // in case the updateStruct is empty and if remoteId already exists. Since REST version of update struct
135 // includes section ID in addition to other fields, we cannot throw exception if only sectionId property
136 // is set, so we must skip updating content in that case instead of allowing propagation of the exception.
137 foreach ($updateStruct as $propertyName => $propertyValue) {
138 if ($propertyName !== 'sectionId' && $propertyValue !== null) {
139 // update content
140 $this->repository->getContentService()->updateContentMetadata($contentInfo, $updateStruct);
141 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
142 break;
143 }
144 }
145
146 try {
147 $locationInfo = $this->repository->getLocationService()->loadLocation($contentInfo->mainLocationId);
148 } catch (NotFoundException $e) {
149 $locationInfo = null;
150 }
151
152 return new Values\RestContent(
153 $contentInfo,
154 $locationInfo
155 );
156 }
157
165 public function redirectCurrentVersion($contentId)
166 {
167 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
168
169 return new Values\TemporaryRedirect(
170 $this->router->generate(
171 'ezpublish_rest_loadContentInVersion',
172 [
173 'contentId' => $contentId,
174 'versionNumber' => $contentInfo->currentVersionNo,
175 ]
176 )
177 );
178 }
179
188 public function loadContentInVersion($contentId, $versionNumber, Request $request)
189 {
190 $languages = Language::ALL;
191 if ($request->query->has('languages')) {
192 $languages = explode(',', $request->query->get('languages'));
193 }
194
195 $content = $this->repository->getContentService()->loadContent(
196 $contentId,
197 $languages,
198 $versionNumber
199 );
200 $contentType = $this->repository->getContentTypeService()->loadContentType(
201 $content->getVersionInfo()->getContentInfo()->contentTypeId
202 );
203
204 $versionValue = new Values\Version(
205 $content,
206 $contentType,
207 $this->repository->getContentService()->loadRelations($content->getVersionInfo()),
208 $request->getPathInfo()
209 );
210
211 if ($content->contentInfo->mainLocationId === null || $content->versionInfo->status === VersionInfo::STATUS_DRAFT) {
212 return $versionValue;
213 }
214
215 return new Values\CachedValue(
216 $versionValue,
217 ['locationId' => $content->contentInfo->mainLocationId]
218 );
219 }
220
234 public function createContent(Request $request)
235 {
236 $contentCreate = $this->parseContentRequest($request);
237
238 return $this->doCreateContent($request, $contentCreate);
239 }
240
249 public function deleteContent($contentId)
250 {
251 $this->repository->getContentService()->deleteContent(
252 $this->repository->getContentService()->loadContentInfo($contentId)
253 );
254
255 return new Values\NoContent();
256 }
257
265 public function copyContent($contentId, Request $request)
266 {
267 $destination = $request->headers->get('Destination');
268
269 $parentLocationParts = explode('/', $destination);
270 $copiedContent = $this->repository->getContentService()->copyContent(
271 $this->repository->getContentService()->loadContentInfo($contentId),
272 $this->repository->getLocationService()->newLocationCreateStruct(array_pop($parentLocationParts))
273 );
274
275 return new Values\ResourceCreated(
276 $this->router->generate(
277 'ezpublish_rest_loadContent',
278 ['contentId' => $copiedContent->id]
279 )
280 );
281 }
282
295 public function deleteContentTranslation($contentId, $languageCode)
296 {
297 $contentService = $this->repository->getContentService();
298
299 $this->repository->beginTransaction();
300 try {
301 $contentInfo = $contentService->loadContentInfo($contentId);
302 $contentService->deleteTranslation(
303 $contentInfo,
304 $languageCode
305 );
306
307 $this->repository->commit();
308
309 return new Values\NoContent();
310 } catch (\Exception $e) {
311 $this->repository->rollback();
312 throw $e;
313 }
314 }
315
324 public function loadContentVersions($contentId, Request $request)
325 {
326 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
327
328 return new Values\VersionList(
329 $this->repository->getContentService()->loadVersions($contentInfo),
330 $request->getPathInfo()
331 );
332 }
333
344 public function deleteContentVersion($contentId, $versionNumber)
345 {
346 $versionInfo = $this->repository->getContentService()->loadVersionInfo(
347 $this->repository->getContentService()->loadContentInfo($contentId),
348 $versionNumber
349 );
350
351 if ($versionInfo->isPublished()) {
352 throw new ForbiddenException('Version in status PUBLISHED cannot be deleted');
353 }
354
355 $this->repository->getContentService()->deleteVersion(
356 $versionInfo
357 );
358
359 return new Values\NoContent();
360 }
361
373 public function deleteTranslationFromDraft($contentId, $versionNumber, $languageCode)
374 {
375 $contentService = $this->repository->getContentService();
376 $versionInfo = $contentService->loadVersionInfoById($contentId, $versionNumber);
377
378 if (!$versionInfo->isDraft()) {
379 throw new ForbiddenException('Translation can be deleted from DRAFT Version only');
380 }
381
382 $contentService->deleteTranslationFromDraft($versionInfo, $languageCode);
383
384 return new Values\NoContent();
385 }
386
395 public function createDraftFromVersion($contentId, $versionNumber)
396 {
397 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
398 $contentType = $this->repository->getContentTypeService()->loadContentType($contentInfo->contentTypeId);
399 $contentDraft = $this->repository->getContentService()->createContentDraft(
400 $contentInfo,
401 $this->repository->getContentService()->loadVersionInfo($contentInfo, $versionNumber)
402 );
403
404 return new Values\CreatedVersion(
405 [
406 'version' => new Values\Version(
407 $contentDraft,
408 $contentType,
409 $this->repository->getContentService()->loadRelations($contentDraft->getVersionInfo())
410 ),
411 ]
412 );
413 }
414
424 public function createDraftFromCurrentVersion($contentId)
425 {
426 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
427 $contentType = $this->repository->getContentTypeService()->loadContentType($contentInfo->contentTypeId);
428 $versionInfo = $this->repository->getContentService()->loadVersionInfo(
429 $contentInfo
430 );
431
432 if ($versionInfo->isDraft()) {
433 throw new ForbiddenException('Current version is already in status DRAFT');
434 }
435
436 $contentDraft = $this->repository->getContentService()->createContentDraft($contentInfo);
437
438 return new Values\CreatedVersion(
439 [
440 'version' => new Values\Version(
441 $contentDraft,
442 $contentType,
443 $this->repository->getContentService()->loadRelations($contentDraft->getVersionInfo())
444 ),
445 ]
446 );
447 }
448
460 public function updateVersion($contentId, $versionNumber, Request $request)
461 {
462 $contentUpdateStruct = $this->inputDispatcher->parse(
463 new Message(
464 [
465 'Content-Type' => $request->headers->get('Content-Type'),
466 'Url' => $this->router->generate(
467 'ezpublish_rest_updateVersion',
468 [
469 'contentId' => $contentId,
470 'versionNumber' => $versionNumber,
471 ]
472 ),
473 ],
474 $request->getContent()
475 )
476 );
477
478 $versionInfo = $this->repository->getContentService()->loadVersionInfo(
479 $this->repository->getContentService()->loadContentInfo($contentId),
480 $versionNumber
481 );
482
483 if (!$versionInfo->isDraft()) {
484 throw new ForbiddenException('Only version in status DRAFT can be updated');
485 }
486
487 try {
488 $this->repository->getContentService()->updateContent($versionInfo, $contentUpdateStruct);
489 } catch (ContentValidationException $e) {
490 throw new BadRequestException($e->getMessage());
491 } catch (ContentFieldValidationException $e) {
492 throw new RESTContentFieldValidationException($e);
493 }
494
495 $languages = null;
496 if ($request->query->has('languages')) {
497 $languages = explode(',', $request->query->get('languages'));
498 }
499
500 // Reload the content to handle languages GET parameter
501 $content = $this->repository->getContentService()->loadContent(
502 $contentId,
503 $languages,
504 $versionInfo->versionNo
505 );
506 $contentType = $this->repository->getContentTypeService()->loadContentType(
507 $content->getVersionInfo()->getContentInfo()->contentTypeId
508 );
509
510 return new Values\Version(
511 $content,
512 $contentType,
513 $this->repository->getContentService()->loadRelations($content->getVersionInfo()),
514 $request->getPathInfo()
515 );
516 }
517
528 public function publishVersion($contentId, $versionNumber)
529 {
530 $versionInfo = $this->repository->getContentService()->loadVersionInfo(
531 $this->repository->getContentService()->loadContentInfo($contentId),
532 $versionNumber
533 );
534
535 if (!$versionInfo->isDraft()) {
536 throw new ForbiddenException('Only version in status DRAFT can be published');
537 }
538
539 $this->repository->getContentService()->publishVersion(
540 $versionInfo
541 );
542
543 return new Values\NoContent();
544 }
545
553 public function redirectCurrentVersionRelations($contentId)
554 {
555 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
556
557 return new Values\TemporaryRedirect(
558 $this->router->generate(
559 'ezpublish_rest_redirectCurrentVersionRelations',
560 [
561 'contentId' => $contentId,
562 'versionNumber' => $contentInfo->currentVersionNo,
563 ]
564 )
565 );
566 }
567
576 public function loadVersionRelations($contentId, $versionNumber, Request $request)
577 {
578 $offset = $request->query->has('offset') ? (int)$request->query->get('offset') : 0;
579 $limit = $request->query->has('limit') ? (int)$request->query->get('limit') : -1;
580
581 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
582 $relationList = $this->repository->getContentService()->loadRelations(
583 $this->repository->getContentService()->loadVersionInfo($contentInfo, $versionNumber)
584 );
585
586 $relationList = array_slice(
587 $relationList,
588 $offset >= 0 ? $offset : 0,
589 $limit >= 0 ? $limit : null
590 );
591
592 $relationListValue = new Values\RelationList(
593 $relationList,
594 $contentId,
595 $versionNumber,
596 $request->getPathInfo()
597 );
598
599 if ($contentInfo->mainLocationId === null) {
600 return $relationListValue;
601 }
602
603 return new Values\CachedValue(
604 $relationListValue,
605 ['locationId' => $contentInfo->mainLocationId]
606 );
607 }
608
620 public function loadVersionRelation($contentId, $versionNumber, $relationId, Request $request)
621 {
622 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
623 $relationList = $this->repository->getContentService()->loadRelations(
624 $this->repository->getContentService()->loadVersionInfo($contentInfo, $versionNumber)
625 );
626
627 foreach ($relationList as $relation) {
628 if ($relation->id == $relationId) {
629 $relation = new Values\RestRelation($relation, $contentId, $versionNumber);
630
631 if ($contentInfo->mainLocationId === null) {
632 return $relation;
633 }
634
635 return new Values\CachedValue(
636 $relation,
637 ['locationId' => $contentInfo->mainLocationId]
638 );
639 }
640 }
641
642 throw new Exceptions\NotFoundException("Relation not found: '{$request->getPathInfo()}'.");
643 }
644
657 public function removeRelation($contentId, $versionNumber, $relationId, Request $request)
658 {
659 $versionInfo = $this->repository->getContentService()->loadVersionInfo(
660 $this->repository->getContentService()->loadContentInfo($contentId),
661 $versionNumber
662 );
663
664 $versionRelations = $this->repository->getContentService()->loadRelations($versionInfo);
665 foreach ($versionRelations as $relation) {
666 if ($relation->id == $relationId) {
667 if ($relation->type !== Relation::COMMON) {
668 throw new ForbiddenException('Relation is not of type COMMON');
669 }
670
671 if (!$versionInfo->isDraft()) {
672 throw new ForbiddenException('Relation of type COMMON can only be removed from drafts');
673 }
674
675 $this->repository->getContentService()->deleteRelation($versionInfo, $relation->getDestinationContentInfo());
676
677 return new Values\NoContent();
678 }
679 }
680
681 throw new Exceptions\NotFoundException("Relation not found: '{$request->getPathInfo()}'.");
682 }
683
695 public function createRelation($contentId, $versionNumber, Request $request)
696 {
697 $destinationContentId = $this->inputDispatcher->parse(
698 new Message(
699 ['Content-Type' => $request->headers->get('Content-Type')],
700 $request->getContent()
701 )
702 );
703
704 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
705 $versionInfo = $this->repository->getContentService()->loadVersionInfo($contentInfo, $versionNumber);
706 if (!$versionInfo->isDraft()) {
707 throw new ForbiddenException('Relation of type COMMON can only be added to drafts');
708 }
709
710 try {
711 $destinationContentInfo = $this->repository->getContentService()->loadContentInfo($destinationContentId);
712 } catch (NotFoundException $e) {
713 throw new ForbiddenException($e->getMessage());
714 }
715
716 $existingRelations = $this->repository->getContentService()->loadRelations($versionInfo);
717 foreach ($existingRelations as $existingRelation) {
718 if ($existingRelation->getDestinationContentInfo()->id == $destinationContentId) {
719 throw new ForbiddenException('Relation of type COMMON to selected destination content ID already exists');
720 }
721 }
722
723 $relation = $this->repository->getContentService()->addRelation($versionInfo, $destinationContentInfo);
724
725 return new Values\CreatedRelation(
726 [
727 'relation' => new Values\RestRelation($relation, $contentId, $versionNumber),
728 ]
729 );
730 }
731
740 public function hideContent(int $contentId): Values\NoContent
741 {
742 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
743
744 $this->repository->getContentService()->hideContent($contentInfo);
745
746 return new Values\NoContent();
747 }
748
757 public function revealContent(int $contentId): Values\NoContent
758 {
759 $contentInfo = $this->repository->getContentService()->loadContentInfo($contentId);
760
761 $this->repository->getContentService()->revealContent($contentInfo);
762
763 return new Values\NoContent();
764 }
765
773 public function createView()
774 {
775 $response = $this->forward('ezpublish_rest.controller.views:createView');
776
777 // Add 301 status code and location href
778 $response->setStatusCode(301);
779 $response->headers->set('Location', $this->router->generate('ezpublish_rest_views_create'));
780
781 return $response;
782 }
783
789 protected function forward($controller)
790 {
791 $path['_controller'] = $controller;
792 $subRequest = $this->container->get('request_stack')->getCurrentRequest()->duplicate(null, null, $path);
793
794 return $this->container->get('http_kernel')->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
795 }
796
802 protected function parseContentRequest(Request $request)
803 {
804 return $this->inputDispatcher->parse(
805 new Message(
806 ['Content-Type' => $request->headers->get('Content-Type'), 'Url' => $request->getPathInfo()],
807 $request->getContent()
808 )
809 );
810 }
811
822 protected function doCreateContent(Request $request, RestContentCreateStruct $contentCreate)
823 {
824 try {
825 $contentCreateStruct = $contentCreate->contentCreateStruct;
826 $contentCreate->locationCreateStruct->sortField = $contentCreateStruct->contentType->defaultSortField;
827 $contentCreate->locationCreateStruct->sortOrder = $contentCreateStruct->contentType->defaultSortOrder;
828
829 $content = $this->repository->getContentService()->createContent(
830 $contentCreateStruct,
831 [$contentCreate->locationCreateStruct]
832 );
833 } catch (ContentValidationException $e) {
834 throw new BadRequestException($e->getMessage());
835 } catch (ContentFieldValidationException $e) {
836 throw new RESTContentFieldValidationException($e);
837 }
838
839 $contentValue = null;
840 $contentType = null;
841 $relations = null;
842 if ($this->getMediaType($request) === 'application/vnd.ez.api.content') {
843 $contentValue = $content;
844 $contentType = $this->repository->getContentTypeService()->loadContentType(
845 $content->getVersionInfo()->getContentInfo()->contentTypeId
846 );
847 $relations = $this->repository->getContentService()->loadRelations($contentValue->getVersionInfo());
848 }
849
850 return new Values\CreatedContent(
851 [
852 'content' => new Values\RestContent(
853 $content->contentInfo,
854 null,
855 $contentValue,
856 $contentType,
857 $relations
858 ),
859 ]
860 );
861 }
862 }
eZ\Publish\API\Repository\Exceptions\ContentFieldValidationException
This Exception is thrown on create or update content one or more given fields are not valid.
Definition: API/Repository/Exceptions/ContentFieldValidationException.php:13
eZ\Publish\API\Repository\Exceptions\ContentValidationException
This Exception is thrown on create or update content one or more given fields are not valid.
Definition: API/Repository/Exceptions/ContentValidationException.php:13
eZ\Publish\API\Repository\Exceptions\NotFoundException
This Exception is thrown if an object referenced by an id or identifier could not be found in the rep...
Definition: API/Repository/Exceptions/NotFoundException.php:16
eZ\Publish\API\Repository\Values\Content\Content
Definition: Publish/API/Repository/Values/Content/Content.php:21
eZ\Publish\API\Repository\Values\Content\Language
Definition: API/Repository/Values/Content/Language.php:20
eZ\Publish\API\Repository\Values\Content\Relation
Definition: API/Repository/Values/Content/Relation.php:21
eZ\Publish\API\Repository\Values\Content\VersionInfo
Definition: API/Repository/Values/Content/VersionInfo.php:27
eZ\Publish\Core\Base\Exceptions\ForbiddenException
Forbidden Exception implementation.
Definition: Core/Base/Exceptions/ForbiddenException.php:17
eZ\Publish\Core\REST\Common\Message
Simple response struct.
Definition: Core/REST/Common/Message.php:13
eZ\Publish\Core\REST\Server\Controller\Content\redirectCurrentVersion
redirectCurrentVersion($contentId)
Loads a specific version of a given content object.
Definition: Publish/Core/REST/Server/Controller/Content.php:165
eZ\Publish\Core\REST\Server\Controller\Content\createContent
createContent(Request $request)
Creates a new content draft assigned to the authenticated user.
Definition: Publish/Core/REST/Server/Controller/Content.php:234
eZ\Publish\Core\REST\Server\Controller\Content\deleteContentVersion
deleteContentVersion($contentId, $versionNumber)
The version is deleted.
Definition: Publish/Core/REST/Server/Controller/Content.php:344
eZ\Publish\Core\REST\Server\Controller\Content\publishVersion
publishVersion($contentId, $versionNumber)
The content version is published.
Definition: Publish/Core/REST/Server/Controller/Content.php:528
eZ\Publish\Core\REST\Server\Controller\Content\deleteContent
deleteContent($contentId)
The content is deleted.
Definition: Publish/Core/REST/Server/Controller/Content.php:249
eZ\Publish\Core\REST\Server\Controller\Content\updateContentMetadata
updateContentMetadata($contentId, Request $request)
Updates a content's metadata.
Definition: Publish/Core/REST/Server/Controller/Content.php:115
eZ\Publish\Core\REST\Server\Controller\Content\deleteContentTranslation
deleteContentTranslation($contentId, $languageCode)
Deletes a translation from all the Versions of the given Content Object.
Definition: Publish/Core/REST/Server/Controller/Content.php:295
eZ\Publish\Core\REST\Server\Controller\Content\loadContentInVersion
loadContentInVersion($contentId, $versionNumber, Request $request)
Loads a specific version of a given content object.
Definition: Publish/Core/REST/Server/Controller/Content.php:188
eZ\Publish\Core\REST\Server\Controller\Content\parseContentRequest
parseContentRequest(Request $request)
Definition: Publish/Core/REST/Server/Controller/Content.php:802
eZ\Publish\Core\REST\Server\Controller\Content\updateVersion
updateVersion($contentId, $versionNumber, Request $request)
A specific draft is updated.
Definition: Publish/Core/REST/Server/Controller/Content.php:460
eZ\Publish\Core\REST\Server\Controller\Content\hideContent
hideContent(int $contentId)
Definition: Publish/Core/REST/Server/Controller/Content.php:740
eZ\Publish\Core\REST\Server\Controller\Content\deleteTranslationFromDraft
deleteTranslationFromDraft($contentId, $versionNumber, $languageCode)
Remove the given Translation from the given Version Draft.
Definition: Publish/Core/REST/Server/Controller/Content.php:373
eZ\Publish\Core\REST\Server\Controller\Content\revealContent
revealContent(int $contentId)
Definition: Publish/Core/REST/Server/Controller/Content.php:757
eZ\Publish\Core\REST\Server\Controller\Content\loadVersionRelations
loadVersionRelations($contentId, $versionNumber, Request $request)
Loads the relations of the given version.
Definition: Publish/Core/REST/Server/Controller/Content.php:576
eZ\Publish\Core\REST\Server\Controller\Content\createRelation
createRelation($contentId, $versionNumber, Request $request)
Creates a new relation of type COMMON for the given draft.
Definition: Publish/Core/REST/Server/Controller/Content.php:695
eZ\Publish\Core\REST\Server\Controller\Content\forward
forward($controller)
Definition: Publish/Core/REST/Server/Controller/Content.php:789
eZ\Publish\Core\REST\Server\Controller\Content\doCreateContent
doCreateContent(Request $request, RestContentCreateStruct $contentCreate)
Definition: Publish/Core/REST/Server/Controller/Content.php:822
eZ\Publish\Core\REST\Server\Controller\Content\redirectContent
redirectContent(Request $request)
Loads a content info by remote ID.
Definition: Publish/Core/REST/Server/Controller/Content.php:38
eZ\Publish\Core\REST\Server\Controller\Content\redirectCurrentVersionRelations
redirectCurrentVersionRelations($contentId)
Redirects to the relations of the current version.
Definition: Publish/Core/REST/Server/Controller/Content.php:553
eZ\Publish\Core\REST\Server\Controller\Content\createDraftFromCurrentVersion
createDraftFromCurrentVersion($contentId)
The system creates a new draft version as a copy from the current version.
Definition: Publish/Core/REST/Server/Controller/Content.php:424
eZ\Publish\Core\REST\Server\Controller\Content\removeRelation
removeRelation($contentId, $versionNumber, $relationId, Request $request)
Deletes a relation of the given draft.
Definition: Publish/Core/REST/Server/Controller/Content.php:657
eZ\Publish\Core\REST\Server\Controller\Content\loadContentVersions
loadContentVersions($contentId, Request $request)
Returns a list of all versions of the content.
Definition: Publish/Core/REST/Server/Controller/Content.php:324
eZ\Publish\Core\REST\Server\Controller\Content\loadContent
loadContent($contentId, Request $request)
Loads a content info, potentially with the current version embedded.
Definition: Publish/Core/REST/Server/Controller/Content.php:66
eZ\Publish\Core\REST\Server\Controller\Content\copyContent
copyContent($contentId, Request $request)
Creates a new content object as copy under the given parent location given in the destination header.
Definition: Publish/Core/REST/Server/Controller/Content.php:265
eZ\Publish\Core\REST\Server\Controller\Content\createDraftFromVersion
createDraftFromVersion($contentId, $versionNumber)
The system creates a new draft version as a copy from the given version.
Definition: Publish/Core/REST/Server/Controller/Content.php:395
eZ\Publish\Core\REST\Server\Controller\Content\loadVersionRelation
loadVersionRelation($contentId, $versionNumber, $relationId, Request $request)
Loads a relation for the given content object and version.
Definition: Publish/Core/REST/Server/Controller/Content.php:620
eZ\Publish\Core\REST\Server\Controller\Content\createView
createView()
Creates and executes a content view.
Definition: Publish/Core/REST/Server/Controller/Content.php:773
eZ\Publish\Core\REST\Server\Controller\getMediaType
getMediaType(Request $request)
Extracts the requested media type from $request.
Definition: Publish/Core/REST/Server/Controller.php:64
eZ\Publish\Core\REST\Server\Exceptions\BadRequestException
Exception thrown if the request is not formatted correctly.
Definition: Exceptions/BadRequestException.php:15
eZ\Publish\Core\REST\Server\Exceptions\ContentFieldValidationException
Exception thrown if one or more content fields did not validate.
Definition: Core/REST/Server/Exceptions/ContentFieldValidationException.php:15
eZ\Publish\Core\REST\Server\Exceptions\ForbiddenException
Exception thrown if the request is forbidden.
Definition: Core/REST/Server/Exceptions/ForbiddenException.php:15
eZ\Publish\Core\REST\Server\Values\CachedValue
Definition: Values/CachedValue.php:13
eZ\Publish\Core\REST\Server\Values\CreatedContent
Struct representing a freshly created Content.
Definition: Values/CreatedContent.php:15
eZ\Publish\Core\REST\Server\Values\CreatedRelation
Struct representing a freshly created relation.
Definition: Values/CreatedRelation.php:15
eZ\Publish\Core\REST\Server\Values\CreatedVersion
Struct representing a freshly created version.
Definition: Values/CreatedVersion.php:15
eZ\Publish\Core\REST\Server\Values\NoContent
Definition: Values/NoContent.php:12
eZ\Publish\Core\REST\Server\Values\RelationList
Relation list view model.
Definition: Core/REST/Server/Values/RelationList.php:15
eZ\Publish\Core\REST\Server\Values\ResourceCreated
Definition: Values/ResourceCreated.php:12
eZ\Publish\Core\REST\Server\Values\RestContentCreateStruct
RestContentCreateStruct view model.
Definition: Server/Values/RestContentCreateStruct.php:17
eZ\Publish\Core\REST\Server\Values\RestContent
REST Content, as received by /content/objects/<ID>.
Definition: Values/RestContent.php:21
eZ\Publish\Core\REST\Server\Values\RestRelation
RestRelation view model.
Definition: Values/RestRelation.php:16
eZ\Publish\Core\REST\Server\Values\TemporaryRedirect
Definition: Values/TemporaryRedirect.php:12
eZ\Publish\Core\REST\Server\Values\VersionList
Version list view model.
Definition: Values/VersionList.php:15
eZ\Publish\Core\REST\Server\Values\Version
Version view model.
Definition: Core/REST/Server/Values/Version.php:17
eZ\Publish\SPI\Persistence\Content\VersionInfo\STATUS_DRAFT
const STATUS_DRAFT
Definition: SPI/Persistence/Content/VersionInfo.php:21
eZ\Publish\Core\REST\Common\Exceptions
Definition: Core/REST/Common/Exceptions/ForbiddenException.php:7
eZ\Publish\Core\REST\Server\Controller
Definition: BinaryContent.php:7
eZ\Publish\Core\REST\Server\Values
Definition: Core/REST/Server/Values/BookmarkList.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.