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

Core/Persistence/Legacy/Content/Handler.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Persistence\Legacy\Content;
8
9 use Exception;
10 use eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway as LocationGateway;
11 use eZ\Publish\SPI\Persistence\Content\Field;
12 use eZ\Publish\SPI\Persistence\Content\Handler as BaseContentHandler;
13 use eZ\Publish\SPI\Persistence\Content\Type\Handler as ContentTypeHandler;
14 use eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter;
15 use eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway as UrlAliasGateway;
16 use eZ\Publish\SPI\Persistence\Content;
17 use eZ\Publish\SPI\Persistence\Content\CreateStruct;
18 use eZ\Publish\SPI\Persistence\Content\UpdateStruct;
19 use eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct;
20 use eZ\Publish\SPI\Persistence\Content\VersionInfo;
21 use eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct as RelationCreateStruct;
22 use eZ\Publish\Core\Base\Exceptions\NotFoundException as NotFound;
23 use Psr\Log\LoggerInterface;
24 use Psr\Log\NullLogger;
25
29 class Handler implements BaseContentHandler
30 {
36 protected $contentGateway;
37
43 protected $locationGateway;
44
50 protected $mapper;
51
57 protected $fieldHandler;
58
64 protected $slugConverter;
65
71 protected $urlAliasGateway;
72
78 protected $contentTypeHandler;
79
85 protected $treeHandler;
86
88 private $logger;
89
103 public function __construct(
104 Gateway $contentGateway,
105 LocationGateway $locationGateway,
106 Mapper $mapper,
107 FieldHandler $fieldHandler,
108 SlugConverter $slugConverter,
109 UrlAliasGateway $urlAliasGateway,
110 ContentTypeHandler $contentTypeHandler,
111 TreeHandler $treeHandler,
112 LoggerInterface $logger = null
113 ) {
114 $this->contentGateway = $contentGateway;
115 $this->locationGateway = $locationGateway;
116 $this->mapper = $mapper;
117 $this->fieldHandler = $fieldHandler;
118 $this->slugConverter = $slugConverter;
119 $this->urlAliasGateway = $urlAliasGateway;
120 $this->contentTypeHandler = $contentTypeHandler;
121 $this->treeHandler = $treeHandler;
122 $this->logger = null !== $logger ? $logger : new NullLogger();
123 }
124
137 public function create(CreateStruct $struct)
138 {
139 return $this->internalCreate($struct);
140 }
141
155 protected function internalCreate(CreateStruct $struct, $versionNo = 1)
156 {
157 $content = new Content();
158
159 $content->fields = $struct->fields;
160 $content->versionInfo = $this->mapper->createVersionInfoFromCreateStruct($struct, $versionNo);
161
162 $content->versionInfo->contentInfo->id = $this->contentGateway->insertContentObject($struct, $versionNo);
163 $content->versionInfo->id = $this->contentGateway->insertVersion(
164 $content->versionInfo,
165 $struct->fields
166 );
167
168 $contentType = $this->contentTypeHandler->load($struct->typeId);
169 $this->fieldHandler->createNewFields($content, $contentType);
170
171 // Create node assignments
172 foreach ($struct->locations as $location) {
173 $location->contentId = $content->versionInfo->contentInfo->id;
174 $location->contentVersion = $content->versionInfo->versionNo;
175 $this->locationGateway->createNodeAssignment(
176 $location,
177 $location->parentId,
178 LocationGateway::NODE_ASSIGNMENT_OP_CODE_CREATE
179 );
180 }
181
182 // Create names
183 foreach ($content->versionInfo->names as $language => $name) {
184 $this->contentGateway->setName(
185 $content->versionInfo->contentInfo->id,
186 $content->versionInfo->versionNo,
187 $name,
188 $language
189 );
190 }
191
192 return $content;
193 }
194
215 public function publish($contentId, $versionNo, MetadataUpdateStruct $metaDataUpdateStruct)
216 {
217 // Archive currently published version
218 $versionInfo = $this->loadVersionInfo($contentId, $versionNo);
219 if ($versionInfo->contentInfo->currentVersionNo != $versionNo) {
220 $this->setStatus(
221 $contentId,
222 VersionInfo::STATUS_ARCHIVED,
223 $versionInfo->contentInfo->currentVersionNo
224 );
225 }
226
227 // Set always available name for the content
228 $metaDataUpdateStruct->name = $versionInfo->names[$versionInfo->contentInfo->mainLanguageCode];
229
230 $this->contentGateway->updateContent($contentId, $metaDataUpdateStruct, $versionInfo);
231 $this->locationGateway->createLocationsFromNodeAssignments(
232 $contentId,
233 $versionNo
234 );
235
236 $this->locationGateway->updateLocationsContentVersionNo($contentId, $versionNo);
237 $this->contentGateway->setPublishedStatus($contentId, $versionNo);
238
239 return $this->load($contentId, $versionNo);
240 }
241
259 public function createDraftFromVersion($contentId, $srcVersion, $userId, ?string $languageCode = null)
260 {
261 $content = $this->load($contentId, $srcVersion);
262
263 // Create new version
264 $content->versionInfo = $this->mapper->createVersionInfoForContent(
265 $content,
266 $this->contentGateway->getLastVersionNumber($contentId) + 1,
267 $userId,
268 $languageCode
269 );
270 $content->versionInfo->id = $this->contentGateway->insertVersion(
271 $content->versionInfo,
272 $content->fields
273 );
274
275 // Clone fields from previous version and append them to the new one
276 $this->fieldHandler->createExistingFieldsInNewVersion($content);
277
278 // Create relations for new version
279 $relations = $this->contentGateway->loadRelations($contentId, $srcVersion);
280 foreach ($relations as $relation) {
281 $this->contentGateway->insertRelation(
282 new RelationCreateStruct(
283 [
284 'sourceContentId' => $contentId,
285 'sourceContentVersionNo' => $content->versionInfo->versionNo,
286 'sourceFieldDefinitionId' => $relation['ezcontentobject_link_contentclassattribute_id'],
287 'destinationContentId' => $relation['ezcontentobject_link_to_contentobject_id'],
288 'type' => (int)$relation['ezcontentobject_link_relation_type'],
289 ]
290 )
291 );
292 }
293
294 // Create content names for new version
295 foreach ($content->versionInfo->names as $language => $name) {
296 $this->contentGateway->setName(
297 $contentId,
298 $content->versionInfo->versionNo,
299 $name,
300 $language
301 );
302 }
303
304 return $content;
305 }
306
310 public function load($id, $version = null, array $translations = null)
311 {
312 $rows = $this->contentGateway->load($id, $version, $translations);
313
314 if (empty($rows)) {
315 throw new NotFound('content', "contentId: $id, versionNo: $version");
316 }
317
318 $contentObjects = $this->mapper->extractContentFromRows(
319 $rows,
320 $this->contentGateway->loadVersionedNameData([[
321 'id' => $id,
322 'version' => $rows[0]['ezcontentobject_version_version'],
323 ]])
324 );
325 $content = $contentObjects[0];
326 unset($rows, $contentObjects);
327
328 $this->fieldHandler->loadExternalFieldData($content);
329
330 return $content;
331 }
332
336 public function loadContentList(array $contentIds, array $translations = null): array
337 {
338 $rawList = $this->contentGateway->loadContentList($contentIds, $translations);
339 if (empty($rawList)) {
340 return [];
341 }
342
343 $idVersionPairs = [];
344 foreach ($rawList as $row) {
345 // As there is only one version per id, set id as key to avoid duplicates
346 $idVersionPairs[$row['ezcontentobject_id']] = [
347 'id' => $row['ezcontentobject_id'],
348 'version' => $row['ezcontentobject_version_version'],
349 ];
350 }
351
352 // group name data per Content Id
353 $nameData = $this->contentGateway->loadVersionedNameData(array_values($idVersionPairs));
354 $contentItemNameData = [];
355 foreach ($nameData as $nameDataRow) {
356 $contentId = $nameDataRow['ezcontentobject_name_contentobject_id'];
357 $contentItemNameData[$contentId][] = $nameDataRow;
358 }
359
360 // group rows per Content Id be able to ignore Content items with erroneous data
361 $contentItemsRows = [];
362 foreach ($rawList as $row) {
363 $contentId = $row['ezcontentobject_id'];
364 $contentItemsRows[$contentId][] = $row;
365 }
366 unset($rawList, $idVersionPairs);
367
368 // try to extract Content from each Content data
369 $contentItems = [];
370 foreach ($contentItemsRows as $contentId => $contentItemsRow) {
371 try {
372 $contentList = $this->mapper->extractContentFromRows(
373 $contentItemsRow,
374 $contentItemNameData[$contentId]
375 );
376 $contentItems[$contentId] = $contentList[0];
377 } catch (Exception $e) {
378 $this->logger->warning(
379 sprintf(
380 '%s: Content %d not loaded: %s',
381 __METHOD__,
382 $contentId,
383 $e->getMessage()
384 )
385 );
386 }
387 }
388
389 // try to load External Storage data for each Content, ignore Content items for which it failed
390 foreach ($contentItems as $contentId => $content) {
391 try {
392 $this->fieldHandler->loadExternalFieldData($content);
393 } catch (Exception $e) {
394 unset($contentItems[$contentId]);
395 $this->logger->warning(
396 sprintf(
397 '%s: Content %d not loaded: %s',
398 __METHOD__,
399 $contentId,
400 $e->getMessage()
401 )
402 );
403 }
404 }
405
406 return $contentItems;
407 }
408
416 public function loadContentInfo($contentId)
417 {
418 return $this->treeHandler->loadContentInfo($contentId);
419 }
420
421 public function loadContentInfoList(array $contentIds)
422 {
423 $list = $this->mapper->extractContentInfoFromRows(
424 $this->contentGateway->loadContentInfoList($contentIds)
425 );
426
427 $listByContentId = [];
428 foreach ($list as $item) {
429 $listByContentId[$item->id] = $item;
430 }
431
432 return $listByContentId;
433 }
434
442 public function loadContentInfoByRemoteId($remoteId)
443 {
444 return $this->mapper->extractContentInfoFromRow(
445 $this->contentGateway->loadContentInfoByRemoteId($remoteId)
446 );
447 }
448
452 public function loadVersionInfo($contentId, $versionNo = null)
453 {
454 $rows = $this->contentGateway->loadVersionInfo($contentId, $versionNo);
455 if (empty($rows)) {
456 throw new NotFound('content', $contentId);
457 }
458
459 $versionInfo = $this->mapper->extractVersionInfoListFromRows(
460 $rows,
461 $this->contentGateway->loadVersionedNameData([['id' => $contentId, 'version' => $rows[0]['ezcontentobject_version_version']]])
462 );
463
464 return reset($versionInfo);
465 }
466
474 public function countDraftsForUser(int $userId): int
475 {
476 return $this->contentGateway->countVersionsForUser($userId, VersionInfo::STATUS_DRAFT);
477 }
478
486 public function loadDraftsForUser($userId)
487 {
488 $rows = $this->contentGateway->listVersionsForUser($userId, VersionInfo::STATUS_DRAFT);
489 if (empty($rows)) {
490 return [];
491 }
492
493 $idVersionPairs = array_map(
494 function ($row) {
495 return [
496 'id' => $row['ezcontentobject_version_contentobject_id'],
497 'version' => $row['ezcontentobject_version_version'],
498 ];
499 },
500 $rows
501 );
502 $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs);
503
504 return $this->mapper->extractVersionInfoListFromRows($rows, $nameRows);
505 }
506
510 public function loadDraftListForUser(int $userId, int $offset = 0, int $limit = -1): array
511 {
512 $rows = $this->contentGateway->loadVersionsForUser($userId, VersionInfo::STATUS_DRAFT, $offset, $limit);
513 if (empty($rows)) {
514 return [];
515 }
516
517 $idVersionPairs = array_map(
518 static function (array $row): array {
519 return [
520 'id' => $row['ezcontentobject_version_contentobject_id'],
521 'version' => $row['ezcontentobject_version_version'],
522 ];
523 },
524 $rows
525 );
526 $nameRows = $this->contentGateway->loadVersionedNameData($idVersionPairs);
527
528 return $this->mapper->extractVersionInfoListFromRows($rows, $nameRows);
529 }
530
543 public function setStatus($contentId, $status, $version)
544 {
545 return $this->contentGateway->setStatus($contentId, $version, $status);
546 }
547
556 public function updateMetadata($contentId, MetadataUpdateStruct $content)
557 {
558 $this->contentGateway->updateContent($contentId, $content);
559 $this->updatePathIdentificationString($contentId, $content);
560
561 return $this->loadContentInfo($contentId);
562 }
563
573 protected function updatePathIdentificationString($contentId, MetadataUpdateStruct $content)
574 {
575 if (isset($content->mainLanguageId)) {
576 $contentLocationsRows = $this->locationGateway->loadLocationDataByContent($contentId);
577 foreach ($contentLocationsRows as $row) {
578 $locationName = '';
579 $urlAliasRows = $this->urlAliasGateway->loadLocationEntries(
580 $row['node_id'],
581 false,
582 $content->mainLanguageId
583 );
584 if (!empty($urlAliasRows)) {
585 $locationName = $urlAliasRows[0]['text'];
586 }
587 $this->locationGateway->updatePathIdentificationString(
588 $row['node_id'],
589 $row['parent_node_id'],
590 $this->slugConverter->convert(
591 $locationName,
592 'node_' . $row['node_id'],
593 'urlalias_compat'
594 )
595 );
596 }
597 }
598 }
599
609 public function updateContent($contentId, $versionNo, UpdateStruct $updateStruct)
610 {
611 $content = $this->load($contentId, $versionNo);
612 $this->contentGateway->updateVersion($contentId, $versionNo, $updateStruct);
613 $contentType = $this->contentTypeHandler->load($content->versionInfo->contentInfo->contentTypeId);
614 $this->fieldHandler->updateFields($content, $updateStruct, $contentType);
615 foreach ($updateStruct->name as $language => $name) {
616 $this->contentGateway->setName(
617 $contentId,
618 $versionNo,
619 $name,
620 $language
621 );
622 }
623
624 return $this->load($contentId, $versionNo);
625 }
626
637 public function deleteContent($contentId)
638 {
639 $contentLocations = $this->contentGateway->getAllLocationIds($contentId);
640 if (empty($contentLocations)) {
641 $this->removeRawContent($contentId);
642 } else {
643 foreach ($contentLocations as $locationId) {
644 $this->treeHandler->removeSubtree($locationId);
645 }
646 }
647 }
648
654 public function removeRawContent($contentId)
655 {
656 $this->treeHandler->removeRawContent($contentId);
657 }
658
669 public function deleteVersion($contentId, $versionNo)
670 {
671 $versionInfo = $this->loadVersionInfo($contentId, $versionNo);
672
673 $this->locationGateway->deleteNodeAssignment($contentId, $versionNo);
674
675 $this->fieldHandler->deleteFields($contentId, $versionInfo);
676
677 $this->contentGateway->deleteRelations($contentId, $versionNo);
678 $this->contentGateway->deleteVersions($contentId, $versionNo);
679 $this->contentGateway->deleteNames($contentId, $versionNo);
680 }
681
693 public function listVersions($contentId, $status = null, $limit = -1)
694 {
695 return $this->treeHandler->listVersions($contentId, $status, $limit);
696 }
697
711 public function copy($contentId, $versionNo = null, $newOwnerId = null)
712 {
713 $currentVersionNo = isset($versionNo) ?
714 $versionNo :
715 $this->loadContentInfo($contentId)->currentVersionNo;
716
717 // Copy content in given version or current version
718 $createStruct = $this->mapper->createCreateStructFromContent(
719 $this->load($contentId, $currentVersionNo)
720 );
721 if ($newOwnerId) {
722 $createStruct->ownerId = $newOwnerId;
723 }
724 $content = $this->internalCreate($createStruct, $currentVersionNo);
725
726 // If version was not passed also copy other versions
727 if (!isset($versionNo)) {
728 $contentType = $this->contentTypeHandler->load($createStruct->typeId);
729
730 foreach ($this->listVersions($contentId) as $versionInfo) {
731 if ($versionInfo->versionNo === $currentVersionNo) {
732 continue;
733 }
734
735 $versionContent = $this->load($contentId, $versionInfo->versionNo);
736
737 $versionContent->versionInfo->contentInfo->id = $content->versionInfo->contentInfo->id;
738 $versionContent->versionInfo->modificationDate = $createStruct->modified;
739 $versionContent->versionInfo->creationDate = $createStruct->modified;
740 $versionContent->versionInfo->creatorId = $createStruct->ownerId;
741
742 $versionContent->versionInfo->id = $this->contentGateway->insertVersion(
743 $versionContent->versionInfo,
744 $versionContent->fields
745 );
746
747 $this->fieldHandler->createNewFields($versionContent, $contentType);
748
749 // Create names
750 foreach ($versionContent->versionInfo->names as $language => $name) {
751 $this->contentGateway->setName(
752 $content->versionInfo->contentInfo->id,
753 $versionInfo->versionNo,
754 $name,
755 $language
756 );
757 }
758 }
759
760 // Batch copy relations for all versions
761 $this->contentGateway->copyRelations($contentId, $content->versionInfo->contentInfo->id);
762 } else {
763 // Batch copy relations for published version
764 $this->contentGateway->copyRelations($contentId, $content->versionInfo->contentInfo->id, $versionNo);
765 }
766
767 return $content;
768 }
769
780 public function addRelation(RelationCreateStruct $createStruct)
781 {
782 $relation = $this->mapper->createRelationFromCreateStruct($createStruct);
783
784 $relation->id = $this->contentGateway->insertRelation($createStruct);
785
786 return $relation;
787 }
788
800 public function removeRelation($relationId, $type)
801 {
802 $this->contentGateway->deleteRelation($relationId, $type);
803 }
804
817 public function loadRelations($sourceContentId, $sourceContentVersionNo = null, $type = null)
818 {
819 return $this->mapper->extractRelationsFromRows(
820 $this->contentGateway->loadRelations($sourceContentId, $sourceContentVersionNo, $type)
821 );
822 }
823
827 public function countReverseRelations(int $destinationContentId, ?int $type = null): int
828 {
829 return $this->contentGateway->countReverseRelations($destinationContentId, $type);
830 }
831
845 public function loadReverseRelations($destinationContentId, $type = null)
846 {
847 return $this->mapper->extractRelationsFromRows(
848 $this->contentGateway->loadReverseRelations($destinationContentId, $type)
849 );
850 }
851
855 public function loadReverseRelationList(
856 int $destinationContentId,
857 int $offset = 0,
858 int $limit = -1,
859 ?int $type = null
860 ): array {
861 return $this->mapper->extractRelationsFromRows(
862 $this->contentGateway->listReverseRelations($destinationContentId, $offset, $limit, $type)
863 );
864 }
865
869 public function removeTranslationFromContent($contentId, $languageCode)
870 {
871 @trigger_error(
872 __METHOD__ . ' is deprecated, use deleteTranslationFromContent instead',
873 E_USER_DEPRECATED
874 );
875 $this->deleteTranslationFromContent($contentId, $languageCode);
876 }
877
881 public function deleteTranslationFromContent($contentId, $languageCode)
882 {
883 $this->fieldHandler->deleteTranslationFromContentFields(
884 $contentId,
885 $this->listVersions($contentId),
886 $languageCode
887 );
888 $this->contentGateway->deleteTranslationFromContent($contentId, $languageCode);
889 }
890
894 public function deleteTranslationFromDraft($contentId, $versionNo, $languageCode)
895 {
896 $versionInfo = $this->loadVersionInfo($contentId, $versionNo);
897
898 $this->fieldHandler->deleteTranslationFromVersionFields(
899 $versionInfo,
900 $languageCode
901 );
902 $this->contentGateway->deleteTranslationFromVersion(
903 $contentId,
904 $versionNo,
905 $languageCode
906 );
907
908 // get all [languageCode => name] entries except the removed Translation
909 $names = array_filter(
910 $versionInfo->names,
911 function ($lang) use ($languageCode) {
912 return $lang !== $languageCode;
913 },
914 ARRAY_FILTER_USE_KEY
915 );
916 // set new Content name
917 foreach ($names as $language => $name) {
918 $this->contentGateway->setName(
919 $contentId,
920 $versionNo,
921 $name,
922 $language
923 );
924 }
925
926 // reload entire Version w/o removed Translation
927 return $this->load($contentId, $versionNo);
928 }
929 }
eZ\Publish\Core\Base\Exceptions\NotFoundException
Not Found Exception implementation.
Definition: Core/Base/Exceptions/NotFoundException.php:21
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler
Field Handler.
Definition: FieldHandler.php:22
eZ\Publish\Core\Persistence\Legacy\Content\Gateway
Base class for content gateways.
Definition: Persistence/Legacy/Content/Gateway.php:21
eZ\Publish\Core\Persistence\Legacy\Content\Handler
The Content Handler stores Content and ContentType objects.
Definition: Core/Persistence/Legacy/Content/Handler.php:30
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$mapper
$mapper
Definition: Core/Persistence/Legacy/Content/Handler.php:50
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$treeHandler
$treeHandler
Definition: Core/Persistence/Legacy/Content/Handler.php:85
eZ\Publish\Core\Persistence\Legacy\Content\Handler\load
load($id, $version=null, array $translations=null)
{Returns the raw data of a content object identified by $id, in a struct.If you want to load current ...
Definition: Core/Persistence/Legacy/Content/Handler.php:310
eZ\Publish\Core\Persistence\Legacy\Content\Handler\removeTranslationFromContent
removeTranslationFromContent($contentId, $languageCode)
{Remove the specified translation from all the Versions of a Content Object.since 6....
Definition: Core/Persistence/Legacy/Content/Handler.php:869
eZ\Publish\Core\Persistence\Legacy\Content\Handler\deleteContent
deleteContent($contentId)
Deletes all versions and fields, all locations (subtree), and all relations.
Definition: Core/Persistence/Legacy/Content/Handler.php:637
eZ\Publish\Core\Persistence\Legacy\Content\Handler\updateContent
updateContent($contentId, $versionNo, UpdateStruct $updateStruct)
Updates a content version, identified by $contentId and $versionNo.
Definition: Core/Persistence/Legacy/Content/Handler.php:609
eZ\Publish\Core\Persistence\Legacy\Content\Handler\setStatus
setStatus($contentId, $status, $version)
Sets the status of object identified by $contentId and $version to $status.
Definition: Core/Persistence/Legacy/Content/Handler.php:543
eZ\Publish\Core\Persistence\Legacy\Content\Handler\deleteTranslationFromContent
deleteTranslationFromContent($contentId, $languageCode)
{Delete the specified translation from all the Versions of a Content Object.language code of the tran...
Definition: Core/Persistence/Legacy/Content/Handler.php:881
eZ\Publish\Core\Persistence\Legacy\Content\Handler\addRelation
addRelation(RelationCreateStruct $createStruct)
Creates a relation between $sourceContentId in $sourceContentVersionNo and $destinationContentId with...
Definition: Core/Persistence/Legacy/Content/Handler.php:780
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadReverseRelations
loadReverseRelations($destinationContentId, $type=null)
Loads relations from $contentId.
Definition: Core/Persistence/Legacy/Content/Handler.php:845
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$locationGateway
$locationGateway
Definition: Core/Persistence/Legacy/Content/Handler.php:43
eZ\Publish\Core\Persistence\Legacy\Content\Handler\createDraftFromVersion
createDraftFromVersion($contentId, $srcVersion, $userId, ?string $languageCode=null)
Creates a new draft version from $contentId in $version.
Definition: Core/Persistence/Legacy/Content/Handler.php:259
eZ\Publish\Core\Persistence\Legacy\Content\Handler\__construct
__construct(Gateway $contentGateway, LocationGateway $locationGateway, Mapper $mapper, FieldHandler $fieldHandler, SlugConverter $slugConverter, UrlAliasGateway $urlAliasGateway, ContentTypeHandler $contentTypeHandler, TreeHandler $treeHandler, LoggerInterface $logger=null)
Creates a new content handler.
Definition: Core/Persistence/Legacy/Content/Handler.php:103
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadContentList
loadContentList(array $contentIds, array $translations=null)
{Return list of unique Content, with content id as key.Missing items (NotFound) will be missing from ...
Definition: Core/Persistence/Legacy/Content/Handler.php:336
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$contentTypeHandler
$contentTypeHandler
Definition: Core/Persistence/Legacy/Content/Handler.php:78
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadRelations
loadRelations($sourceContentId, $sourceContentVersionNo=null, $type=null)
Loads relations from $sourceContentId.
Definition: Core/Persistence/Legacy/Content/Handler.php:817
eZ\Publish\Core\Persistence\Legacy\Content\Handler\publish
publish($contentId, $versionNo, MetadataUpdateStruct $metaDataUpdateStruct)
Performs the publishing operations required to set the version identified by $updateStruct->versionNo...
Definition: Core/Persistence/Legacy/Content/Handler.php:215
eZ\Publish\Core\Persistence\Legacy\Content\Handler\create
create(CreateStruct $struct)
Creates a new Content entity in the storage engine.
Definition: Core/Persistence/Legacy/Content/Handler.php:137
eZ\Publish\Core\Persistence\Legacy\Content\Handler\countDraftsForUser
countDraftsForUser(int $userId)
Returns the number of versions with draft status created by the given $userId.
Definition: Core/Persistence/Legacy/Content/Handler.php:474
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadDraftsForUser
loadDraftsForUser($userId)
Returns all versions with draft status created by the given $userId.
Definition: Core/Persistence/Legacy/Content/Handler.php:486
eZ\Publish\Core\Persistence\Legacy\Content\Handler\listVersions
listVersions($contentId, $status=null, $limit=-1)
Returns the versions for $contentId.
Definition: Core/Persistence/Legacy/Content/Handler.php:693
eZ\Publish\Core\Persistence\Legacy\Content\Handler\updatePathIdentificationString
updatePathIdentificationString($contentId, MetadataUpdateStruct $content)
Updates path identification string for locations of given $contentId if main language is set in updat...
Definition: Core/Persistence/Legacy/Content/Handler.php:573
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadVersionInfo
loadVersionInfo($contentId, $versionNo=null)
{Returns the version object for a content/version identified by $contentId and $versionNo....
Definition: Core/Persistence/Legacy/Content/Handler.php:452
eZ\Publish\Core\Persistence\Legacy\Content\Handler\deleteVersion
deleteVersion($contentId, $versionNo)
Deletes given version, its fields, node assignment, relations and names.
Definition: Core/Persistence/Legacy/Content/Handler.php:669
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$fieldHandler
$fieldHandler
Definition: Core/Persistence/Legacy/Content/Handler.php:57
eZ\Publish\Core\Persistence\Legacy\Content\Handler\countReverseRelations
countReverseRelations(int $destinationContentId, ?int $type=null)
{Counts relations from $destinationContentId only against published versions.Optionally,...
Definition: Core/Persistence/Legacy/Content/Handler.php:827
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$contentGateway
$contentGateway
Definition: Core/Persistence/Legacy/Content/Handler.php:36
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadDraftListForUser
loadDraftListForUser(int $userId, int $offset=0, int $limit=-1)
{Loads drafts for a user when content is not in the trash.The list is sorted by modification date....
Definition: Core/Persistence/Legacy/Content/Handler.php:510
eZ\Publish\Core\Persistence\Legacy\Content\Handler\removeRelation
removeRelation($relationId, $type)
Removes a relation by relation Id.
Definition: Core/Persistence/Legacy/Content/Handler.php:800
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$urlAliasGateway
$urlAliasGateway
Definition: Core/Persistence/Legacy/Content/Handler.php:71
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$logger
$logger
Definition: Core/Persistence/Legacy/Content/Handler.php:88
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadReverseRelationList
loadReverseRelationList(int $destinationContentId, int $offset=0, int $limit=-1, ?int $type=null)
{Loads paginated relations from $contentId.Optionally, loads only those with $type....
Definition: Core/Persistence/Legacy/Content/Handler.php:855
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadContentInfoByRemoteId
loadContentInfoByRemoteId($remoteId)
Returns the metadata object for a content identified by $remoteId.
Definition: Core/Persistence/Legacy/Content/Handler.php:442
eZ\Publish\Core\Persistence\Legacy\Content\Handler\$slugConverter
$slugConverter
Definition: Core/Persistence/Legacy/Content/Handler.php:64
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadContentInfo
loadContentInfo($contentId)
Returns the metadata object for a content identified by $contentId.
Definition: Core/Persistence/Legacy/Content/Handler.php:416
eZ\Publish\Core\Persistence\Legacy\Content\Handler\internalCreate
internalCreate(CreateStruct $struct, $versionNo=1)
Creates a new Content entity in the storage engine.
Definition: Core/Persistence/Legacy/Content/Handler.php:155
eZ\Publish\Core\Persistence\Legacy\Content\Handler\removeRawContent
removeRawContent($contentId)
Deletes raw content data.
Definition: Core/Persistence/Legacy/Content/Handler.php:654
eZ\Publish\Core\Persistence\Legacy\Content\Handler\loadContentInfoList
loadContentInfoList(array $contentIds)
Return list of unique Content Info, with content id as key.
Definition: Core/Persistence/Legacy/Content/Handler.php:421
eZ\Publish\Core\Persistence\Legacy\Content\Handler\copy
copy($contentId, $versionNo=null, $newOwnerId=null)
Copy Content with Fields, Versions & Relations from $contentId in $version.
Definition: Core/Persistence/Legacy/Content/Handler.php:711
eZ\Publish\Core\Persistence\Legacy\Content\Handler\deleteTranslationFromDraft
deleteTranslationFromDraft($contentId, $versionNo, $languageCode)
{Remove the specified Translation from the given Version Draft of a Content Object....
Definition: Core/Persistence/Legacy/Content/Handler.php:894
eZ\Publish\Core\Persistence\Legacy\Content\Handler\updateMetadata
updateMetadata($contentId, MetadataUpdateStruct $content)
Updates a content object meta data, identified by $contentId.
Definition: Core/Persistence/Legacy/Content/Handler.php:556
eZ\Publish\Core\Persistence\Legacy\Content\Mapper
Mapper for Content Handler.
Definition: Publish/Core/Persistence/Legacy/Content/Mapper.php:27
eZ\Publish\Core\Persistence\Legacy\Content\TreeHandler
The TreeHandler is an intersect between ContentHandler and LocationHandler, used to avoid circular de...
Definition: TreeHandler.php:20
eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter
URL slug converter.
Definition: SlugConverter.php:15
eZ\Publish\SPI\Persistence\Content\CreateStruct
Definition: SPI/Persistence/Content/CreateStruct.php:12
eZ\Publish\SPI\Persistence\Content\Field
Definition: SPI/Persistence/Content/Field.php:12
eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct
Definition: MetadataUpdateStruct.php:12
eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct
CreateStruct representing a relation between content.
Definition: SPI/Persistence/Content/Relation/CreateStruct.php:15
eZ\Publish\SPI\Persistence\Content\Type\UpdateStruct
Definition: Content/Type/UpdateStruct.php:12
eZ\Publish\SPI\Persistence\Content\UpdateStruct
Definition: Content/UpdateStruct.php:12
eZ\Publish\SPI\Persistence\Content\VersionInfo
This class holds version information data.
Definition: SPI/Persistence/Content/VersionInfo.php:15
eZ\Publish\SPI\Persistence\Content\VersionInfo\STATUS_ARCHIVED
const STATUS_ARCHIVED
Definition: SPI/Persistence/Content/VersionInfo.php:24
eZ\Publish\SPI\Persistence\Content\VersionInfo\STATUS_DRAFT
const STATUS_DRAFT
Definition: SPI/Persistence/Content/VersionInfo.php:21
eZ\Publish\SPI\Persistence\Content
Content value object, bound to a version.
Definition: Publish/SPI/Persistence/Content.php:17
eZ\Publish\SPI\Persistence\Content\Handler
The Content Handler interface defines content operations on the storage engine.
Definition: SPI/Persistence/Content/Handler.php:20
eZ\Publish\SPI\Persistence\Content\Type\Handler
Definition: SPI/Persistence/Content/Type/Handler.php:14
eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway
Definition: Persistence/Legacy/Content/Location/Gateway/DoctrineDatabase.php:7
eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway
Definition: Persistence/Legacy/Content/UrlAlias/Gateway/DoctrineDatabase.php:7
eZ\Publish\Core\Persistence\Legacy\Content
Definition: FieldHandler.php:7
eZ\Publish\SPI\Persistence\Content
Definition: SPI/Persistence/Content/ContentInfo.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.