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

Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
eZ\Publish\Core\Repository\ContentService Class Reference
Inheritance diagram for eZ\Publish\Core\Repository\ContentService:

## Public Member Functions
| __construct (RepositoryInterface $repository, Handler $handler, Helper\DomainMapper $domainMapper, Helper\RelationProcessor $relationProcessor, Helper\NameSchemaService $nameSchemaService, Helper\FieldTypeRegistry $fieldTypeRegistry, array $settings=[])
| Setups service with reference to repository object that created it & corresponding handler. More...
| loadContentInfo ($contentId)
| Loads a content info object. More...
| loadContentInfoList (array $contentIds)
  | {Bulk-load ContentInfo items by id's.Note: It does not throw exceptions on load, just skips erroneous (NotFound or Unauthorized) ContentInfo items. Parameters
  int[] | $contentIds |
Returns \eZ\Publish\API\Repository\Values\Content\ContentInfo[] list of ContentInfo with Content Ids as keys } More...
| internalLoadContentInfo ($id, $isRemoteId=false)
| Loads a content info object. More...
| loadContentInfoByRemoteId ($remoteId)
| Loads a content info object for the given remoteId. More...
| loadVersionInfo (ContentInfo $contentInfo, $versionNo=null)
| Loads a version info of the given content object. More...
| loadVersionInfoById ($contentId, $versionNo=null)
| Loads a version info of the given content object id. More...
| loadContentByContentInfo (ContentInfo $contentInfo, array $languages=null, $versionNo=null, $useAlwaysAvailable=true)
  | {Loads content in a version for the given content info object.If no version number is given, the method returns the current version Exceptions
} More...
| loadContentByVersionInfo (APIVersionInfo $versionInfo, array $languages=null, $useAlwaysAvailable=true)
| {} More...
| loadContent ($contentId, array $languages=null, $versionNo=null, $useAlwaysAvailable=true)
  | {Loads content in a version of the given content object.If no version number is given, the method returns the current version Exceptions
} More...
| internalLoadContent ($id, array $languages=null, $versionNo=null, $isRemoteId=false, $useAlwaysAvailable=true)
| Loads content in a version of the given content object. More...
| loadContentByRemoteId ($remoteId, array $languages=null, $versionNo=null, $useAlwaysAvailable=true)
| Loads content in a version for the content object reference by the given remote id. More...
| loadContentListByContentInfo (array $contentInfoList, array $languages=[], $useAlwaysAvailable=true)
| Bulk-load Content items by the list of ContentInfo Value Objects. More...
| updateContentMetadata (ContentInfo $contentInfo, ContentMetadataUpdateStruct $contentMetadataUpdateStruct)
| Updates the metadata. More...
| deleteContent (ContentInfo $contentInfo)
| Deletes a content object including all its versions and locations including their subtrees. More...
| createContentDraft (ContentInfo $contentInfo, APIVersionInfo $versionInfo=null, User $creator=null, ?Language $language=null)
| Creates a draft from a published or archived version. More...
| countContentDrafts (?User $user=null)
  | {Counts drafts for a user.If no user is given the number of drafts for the authenticated user are returned Parameters
  \eZ\Publish\API\Repository\Values\User\User | $user | The user to load drafts for, if defined, otherwise drafts for current-user
  Returns int The number of drafts (VersionInfo) owned by the given user Exceptions
} More...
| loadContentDrafts (User $user=null)
| Loads drafts for a user. More...
| loadContentDraftList (?User $user=null, 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.If no user is given the drafts for the authenticated user are returned Since 7.5.5 Parameters
  \eZ\Publish\API\Repository\Values\User\User | null | $user | The user to load drafts for, if defined, otherwise drafts for current-user
  int | $offset |
  int | $limit |
Returns \eZ\Publish\API\Repository\Values\Content\ContentDraftList } More...
| publishVersion (APIVersionInfo $versionInfo, array $translations=Language::ALL)
| Publishes a content version. More...
| deleteVersion (APIVersionInfo $versionInfo)
| Removes the given version. More...
| loadVersions (ContentInfo $contentInfo, ?int $status=null)
| Loads all versions for the given content. More...
| copyContent (ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, APIVersionInfo $versionInfo=null)
| Copies the content to a new location. More...
| loadRelations (APIVersionInfo $versionInfo)
| Loads all outgoing relations for the given version. More...
| countReverseRelations (ContentInfo $contentInfo)
  | {Counts all incoming relations for the given content object. Parameters
  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $contentInfo |
Returns int The number of reverse relations (Relation) } More...
| loadReverseRelations (ContentInfo $contentInfo)
| Loads all incoming relations for a content object. More...
| loadReverseRelationList (ContentInfo $contentInfo, int $offset=0, int $limit=-1)
  | {Loads all incoming relations for a content object.The relations come only from published versions of the source content objects. If the user is not allowed to read specific version then UnauthorizedRelationListItem is returned \eZ\Publish\API\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem Parameters
  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $contentInfo |
  int | $offset |
  int | $limit |
Returns \eZ\Publish\API\Repository\Values\Content\RelationList } More...
| addRelation (APIVersionInfo $sourceVersion, ContentInfo $destinationContent)
| Adds a relation of type common. More...
| deleteRelation (APIVersionInfo $sourceVersion, ContentInfo $destinationContent)
| Removes a relation of type COMMON from a draft. More...
| removeTranslation (ContentInfo $contentInfo, $languageCode)
  | {Remove Content Object translation from all Versions (including archived ones) of a Content Object.NOTE: this operation is risky and permanent, so user interface (ideally CLI) should provide a warning before performing it. Deprecated: since 6.13, use { See also deleteTranslation} instead Exceptions
} More...
| deleteTranslation (ContentInfo $contentInfo, $languageCode)
| Delete Content item Translation from all Versions (including archived ones) of a Content Object. More...
| deleteTranslationFromDraft (APIVersionInfo $versionInfo, $languageCode)
| Delete specified Translation from a Content Draft. More...
| hideContent (ContentInfo $contentInfo)
| Hides Content by making all the Locations appear hidden. More...
| revealContent (ContentInfo $contentInfo)
| Reveals Content hidden by hideContent API. More...
| newContentCreateStruct (ContentType $contentType, $mainLanguageCode)
| Instantiates a new content create struct object. More...
| newContentMetadataUpdateStruct ()
| Instantiates a new content meta data update struct. More...
| newContentUpdateStruct ()
| Instantiates a new content update struct. More...
Public Member Functions inherited from eZ\Publish\API\Repository\ContentService
| loadContentByVersionInfo (VersionInfo $versionInfo, array $languages=null, $useAlwaysAvailable=true)
| Loads content in the version given by version info. More...
| createContent (ContentCreateStruct $contentCreateStruct, array $locationCreateStructs=[])
| Creates a new content draft assigned to the authenticated user. More...
| createContentDraft (ContentInfo $contentInfo, VersionInfo $versionInfo=null, User $creator=null, ?Language $language=null)
| Creates a draft from a published or archived version. More...
| updateContent (VersionInfo $versionInfo, ContentUpdateStruct $contentUpdateStruct)
| Updates the fields of a draft. More...
| publishVersion (VersionInfo $versionInfo, array $translations=Language::ALL)
| Publishes a content version. More...
| deleteVersion (VersionInfo $versionInfo)
| Removes the given version. More...
| copyContent (ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, VersionInfo $versionInfo=null)
| Copies the content to a new location. More...
| loadRelations (VersionInfo $versionInfo)
| Loads all outgoing relations for the given version. More...
| addRelation (VersionInfo $sourceVersion, ContentInfo $destinationContent)
| Adds a relation of type common. More...
| deleteRelation (VersionInfo $sourceVersion, ContentInfo $destinationContent)
| Removes a relation of type COMMON from a draft. More...
| deleteTranslationFromDraft (VersionInfo $versionInfo, $languageCode)
| Delete specified Translation from a Content Draft. More...

## Protected Member Functions
| getDefaultObjectStates ()
| Returns an array of default content states with content state group id as key. More...
| getLanguageCodesForCreate (APIContentCreateStruct $contentCreateStruct)
| Returns all language codes used in given $fields. More...
| mapFieldsForCreate (APIContentCreateStruct $contentCreateStruct)
| Returns an array of fields like $fields[$field->fieldDefIdentifier][$field->languageCode]. More...
| buildSPILocationCreateStructs (array $locationCreateStructs)
| publishUrlAliasesForContent (APIContent $content, $updatePathIdentificationString=true)
| Publishes URL aliases for all locations of a given content. More...
| getLanguageCodesForUpdate (APIContentUpdateStruct $contentUpdateStruct, APIContent $content)
| Returns all language codes used in given $fields. More...
| mapFieldsForUpdate (APIContentUpdateStruct $contentUpdateStruct, ContentType $contentType, $mainLanguageCode)
| Returns an array of fields like $fields[$field->fieldDefIdentifier][$field->languageCode]. More...
| copyTranslationsFromPublishedVersion (APIVersionInfo $versionInfo, array $translations=[])
| fieldValuesAreEqual (FieldType $fieldType, Value $value1, Value $value2)
| internalPublishVersion (APIVersionInfo $versionInfo, $publicationDate=null)
| Publishes a content version. More...
| getUnixTimestamp ()

## Protected Attributes
| $repository
| $persistenceHandler
| $settings
| $domainMapper
| $relationProcessor
| $nameSchemaService
| $fieldTypeRegistry

## Private Member Functions
| cloneField (Field $field, array $overrides=[])
| Clones $field with overriding specific properties from given $overrides array. More...
| getUpdatedLanguageCodes (APIContentUpdateStruct $contentUpdateStruct)
| Returns only updated language codes. More...
| resolveUser (?User $user)

## Detailed Description

Definition at line 60 of file Core/Repository/ContentService.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Repository\ContentService::__construct | ( | RepositoryInterface | $repository,
|  | Handler | $handler,
|  | Helper\DomainMapper | $domainMapper,
|  | Helper\RelationProcessor | $relationProcessor,
|  | Helper\NameSchemaService | $nameSchemaService,
|  | Helper\FieldTypeRegistry | $fieldTypeRegistry,
|  | array | $settings = `[]`
| ) |  |

Setups service with reference to repository object that created it & corresponding handler.

Parameters

  \eZ\Publish\API\Repository\Repository | $repository |
  \eZ\Publish\SPI\Persistence\Handler | $handler |
  \eZ\Publish\Core\Repository\Helper\DomainMapper | $domainMapper |
  \eZ\Publish\Core\Repository\Helper\RelationProcessor | $relationProcessor |
  \eZ\Publish\Core\Repository\Helper\NameSchemaService | $nameSchemaService |
  \eZ\Publish\Core\Repository\Helper\FieldTypeRegistry | $fieldTypeRegistry |

Definition at line 94 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\$domainMapper, eZ\Publish\Core\Repository\ContentService\$fieldTypeRegistry, eZ\Publish\Core\Repository\ContentService\$nameSchemaService, eZ\Publish\Core\Repository\ContentService\$relationProcessor, eZ\Publish\Core\Repository\ContentService\$repository, and eZ\Publish\Core\Repository\ContentService\$settings.

## Member Function Documentation

## ◆ addRelation()

eZ\Publish\Core\Repository\ContentService::addRelation | ( | APIVersionInfo | $sourceVersion,
|  | ContentInfo | $destinationContent
| ) |  |

Adds a relation of type common.

The source of the relation is the content and version referenced by $versionInfo.

Exceptions

Definition at line 2191 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\loadVersionInfoById().

## ◆ buildSPILocationCreateStructs()

eZ\Publish\Core\Repository\ContentService::buildSPILocationCreateStructs | ( | array | $locationCreateStructs | ) |
| protected

Exceptions

Definition at line 853 of file Core/Repository/ContentService.php.

References eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_MAP, eZ\Publish\API\Repository\Values\Content\Location\SORT_FIELD_NAME, eZ\Publish\API\Repository\Values\Content\Location\SORT_ORDER_ASC, and eZ\Publish\API\Repository\Values\Content\Location\SORT_ORDER_MAP.

## ◆ cloneField()

eZ\Publish\Core\Repository\ContentService::cloneField | ( | Field | $field,
|  | array | $overrides = `[]`
| ) |  |
| private

Clones $field with overriding specific properties from given $overrides array.

Parameters

  Field | $field |
  array | $overrides |

Returns
  Field

Definition at line 830 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\mapFieldsForCreate(), and eZ\Publish\Core\Repository\ContentService\mapFieldsForUpdate().

## ◆ copyContent()

eZ\Publish\Core\Repository\ContentService::copyContent | ( | ContentInfo | $contentInfo,
|  | LocationCreateStruct | $destinationLocationCreateStruct,
|  | APIVersionInfo | $versionInfo = `null`
| ) |  |

Copies the content to a new location.

If no version is given, all versions are copied, otherwise only the given version.

Exceptions

Definition at line 1971 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\getDefaultObjectStates(), eZ\Publish\Core\Repository\ContentService\internalLoadContent(), and eZ\Publish\Core\Repository\ContentService\internalPublishVersion().

## ◆ copyTranslationsFromPublishedVersion()

eZ\Publish\Core\Repository\ContentService::copyTranslationsFromPublishedVersion | ( | APIVersionInfo | $versionInfo,
|  | array | $translations = `[]`
| ) |  |
| protected

Parameters

  \eZ\Publish\API\Repository\Values\Content\VersionInfo | $versionInfo |
  array | $translations |

Exceptions

Definition at line 1661 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\internalLoadContent(), and eZ\Publish\Core\Repository\ContentService\newContentUpdateStruct().

Referenced by eZ\Publish\Core\Repository\ContentService\publishVersion().

## ◆ countContentDrafts()

eZ\Publish\Core\Repository\ContentService::countContentDrafts | ( | ?User | $user = `null` | ) |

{Counts drafts for a user.If no user is given the number of drafts for the authenticated user are returned

Parameters

  \eZ\Publish\API\Repository\Values\User\User | $user | The user to load drafts for, if defined, otherwise drafts for current-user

Returns
  int The number of drafts (VersionInfo) owned by the given user

Exceptions

}

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 1183 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\resolveUser().

## ◆ countReverseRelations()

eZ\Publish\Core\Repository\ContentService::countReverseRelations | ( | ContentInfo | $contentInfo | ) |

{Counts all incoming relations for the given content object.

Parameters

  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $contentInfo |

Returns
  int The number of reverse relations (Relation)

}

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2087 of file Core/Repository/ContentService.php.

## ◆ createContentDraft()

eZ\Publish\Core\Repository\ContentService::createContentDraft | ( | ContentInfo | $contentInfo,
|  | APIVersionInfo | $versionInfo = `null`,
|  | User | $creator = `null`,
|  | ?Language | $language = `null`
| ) |  |

Creates a draft from a published or archived version.

If no version is given, the current published version is used.

Parameters

  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $contentInfo |
  \eZ\Publish\API\Repository\Values\Content\VersionInfo | $versionInfo |
  \eZ\Publish\API\Repository\Values\User\User | $creator | if set given user is used to create the draft - otherwise the current-user is used

Definition at line 1091 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\loadContentInfo(), eZ\Publish\Core\Repository\ContentService\loadVersionInfoById(), eZ\Publish\API\Repository\Values\Content\VersionInfo\STATUS_ARCHIVED, and eZ\Publish\API\Repository\Values\Content\VersionInfo\STATUS_PUBLISHED.

## ◆ deleteContent()

eZ\Publish\Core\Repository\ContentService::deleteContent | ( | ContentInfo | $contentInfo | ) |

Deletes a content object including all its versions and locations including their subtrees.

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 1041 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\internalLoadContentInfo().

## ◆ deleteRelation()

eZ\Publish\Core\Repository\ContentService::deleteRelation | ( | APIVersionInfo | $sourceVersion,
|  | ContentInfo | $destinationContent
| ) |  |

Removes a relation of type COMMON from a draft.

Exceptions

Definition at line 2243 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\loadVersionInfoById().

## ◆ deleteTranslation()

eZ\Publish\Core\Repository\ContentService::deleteTranslation | ( | ContentInfo | $contentInfo,
|  |  | $languageCode
| ) |  |

Delete Content item Translation from all Versions (including archived ones) of a Content Object.

NOTE: this operation is risky and permanent, so user interface should provide a warning before performing it.

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2323 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\loadVersions().

Referenced by eZ\Publish\Core\Repository\ContentService\removeTranslation().

## ◆ deleteTranslationFromDraft()

eZ\Publish\Core\Repository\ContentService::deleteTranslationFromDraft | ( | APIVersionInfo | $versionInfo,
|  |  | $languageCode
| ) |  |

Delete specified Translation from a Content Draft.

Exceptions

Definition at line 2421 of file Core/Repository/ContentService.php.

## ◆ deleteVersion()

eZ\Publish\Core\Repository\ContentService::deleteVersion | ( | APIVersionInfo | $versionInfo | ) |

Removes the given version.

Exceptions

Definition at line 1867 of file Core/Repository/ContentService.php.

## ◆ fieldValuesAreEqual()

eZ\Publish\Core\Repository\ContentService::fieldValuesAreEqual | ( | FieldType | $fieldType,
|  | Value | $value1,
|  | Value | $value2
| ) |  |
| protected

Definition at line 1757 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\Values\ContentType\FieldType\toHash().

## ◆ getDefaultObjectStates()

eZ\Publish\Core\Repository\ContentService::getDefaultObjectStates | ( |  | ) |
| protected

Returns an array of default content states with content state group id as key.

Returns
  \eZ\Publish\SPI\Persistence\Content\ObjectState[]

Definition at line 727 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\copyContent().

## ◆ getLanguageCodesForCreate()

eZ\Publish\Core\Repository\ContentService::getLanguageCodesForCreate | ( | APIContentCreateStruct | $contentCreateStruct | ) |
| protected

Returns all language codes used in given $fields.

Exceptions

Definition at line 752 of file Core/Repository/ContentService.php.

## ◆ getLanguageCodesForUpdate()

eZ\Publish\Core\Repository\ContentService::getLanguageCodesForUpdate | ( | APIContentUpdateStruct | $contentUpdateStruct,
|  | APIContent | $content
| ) |  |
| protected

Returns all language codes used in given $fields.

Exceptions

Definition at line 1531 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\getUpdatedLanguageCodes().

## ◆ getUnixTimestamp()

eZ\Publish\Core\Repository\ContentService::getUnixTimestamp | ( |  | ) |
| protected

Returns
  int

Definition at line 1853 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\internalPublishVersion().

## ◆ getUpdatedLanguageCodes()

eZ\Publish\Core\Repository\ContentService::getUpdatedLanguageCodes | ( | APIContentUpdateStruct | $contentUpdateStruct | ) |
| private

Returns only updated language codes.

Parameters

  \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct | $contentUpdateStruct |

Returns
  array

Definition at line 1504 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\getLanguageCodesForUpdate().

## ◆ hideContent()

eZ\Publish\Core\Repository\ContentService::hideContent | ( | ContentInfo | $contentInfo | ) |

Hides Content by making all the Locations appear hidden.

It does not persist hidden state on Location object itself.

Content hidden by this API can be revealed by revealContent API.

See also
  revealContent

Parameters

  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $contentInfo |

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2498 of file Core/Repository/ContentService.php.

## ◆ internalLoadContent()

eZ\Publish\Core\Repository\ContentService::internalLoadContent | ( |  | $id,
|  | array | $languages = `null`,
|  |  | $versionNo = `null`,
|  |  | $isRemoteId = `false`,
|  |  | $useAlwaysAvailable = `true`
| ) |  |

Loads content in a version of the given content object.

If no version number is given, the method returns the current version

Exceptions

Definition at line 346 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\copyContent(), eZ\Publish\Core\Repository\ContentService\copyTranslationsFromPublishedVersion(), eZ\Publish\Core\Repository\ContentService\loadContent(), eZ\Publish\Core\Repository\ContentService\loadContentByRemoteId(), and eZ\Publish\Core\Repository\ContentService\publishVersion().

## ◆ internalLoadContentInfo()

eZ\Publish\Core\Repository\ContentService::internalLoadContentInfo | ( |  | $id,
|  |  | $isRemoteId = `false`
| ) |  |

Loads a content info object.

To load fields use loadContent

Exceptions

Definition at line 168 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\deleteContent(), eZ\Publish\Core\Repository\ContentService\loadContentInfo(), eZ\Publish\Core\Repository\ContentService\loadContentInfoByRemoteId(), eZ\Publish\Core\Repository\ContentService\loadReverseRelationList(), and eZ\Publish\Core\Repository\ContentService\loadReverseRelations().

## ◆ internalPublishVersion()

eZ\Publish\Core\Repository\ContentService::internalPublishVersion | ( | APIVersionInfo | $versionInfo,
|  |  | $publicationDate = `null`
| ) |  |
| protected

Publishes a content version.

Publishes a content version and deletes archive versions if they overflow max archive versions. Max archive versions are currently a configuration, but might be moved to be a param of ContentType in the future.

Exceptions

Definition at line 1790 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\getUnixTimestamp(), and eZ\Publish\Core\Repository\ContentService\publishUrlAliasesForContent().

Referenced by eZ\Publish\Core\Repository\ContentService\copyContent(), and eZ\Publish\Core\Repository\ContentService\publishVersion().

## ◆ loadContent()

eZ\Publish\Core\Repository\ContentService::loadContent | ( |  | $contentId,
|  | array | $languages = `null`,
|  |  | $versionNo = `null`,
|  |  | $useAlwaysAvailable = `true`
| ) |  |

{Loads content in a version of the given content object.If no version number is given, the method returns the current version

Exceptions

}

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 311 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\internalLoadContent().

Referenced by eZ\Publish\Core\Repository\ContentService\loadContentByContentInfo(), eZ\Publish\Core\Repository\ContentService\loadContentByVersionInfo(), and eZ\Publish\Core\Repository\ContentService\updateContentMetadata().

## ◆ loadContentByContentInfo()

eZ\Publish\Core\Repository\ContentService::loadContentByContentInfo | ( | ContentInfo | $contentInfo,
|  | array | $languages = `null`,
|  |  | $versionNo = `null`,
|  |  | $useAlwaysAvailable = `true`
| ) |  |

{Loads content in a version for the given content info object.If no version number is given, the method returns the current version

Exceptions

}

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 275 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\loadContent().

## ◆ loadContentByRemoteId()

eZ\Publish\Core\Repository\ContentService::loadContentByRemoteId | ( |  | $remoteId,
|  | array | $languages = `null`,
|  |  | $versionNo = `null`,
|  |  | $useAlwaysAvailable = `true`
| ) |  |

Loads content in a version for the content object reference by the given remote id.

If no version is given, the method returns the current version

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 419 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\internalLoadContent().

## ◆ loadContentByVersionInfo()

eZ\Publish\Core\Repository\ContentService::loadContentByVersionInfo | ( | APIVersionInfo | $versionInfo,
|  | array | $languages = `null`,
|  |  | $useAlwaysAvailable = `true`
| ) |  |

{}

Definition at line 293 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\loadContent().

## ◆ loadContentDraftList()

eZ\Publish\Core\Repository\ContentService::loadContentDraftList | ( | ?User | $user = `null`,
|  | 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.If no user is given the drafts for the authenticated user are returned

Since
  7.5.5

Parameters

  \eZ\Publish\API\Repository\Values\User\User | null | $user | The user to load drafts for, if defined, otherwise drafts for current-user
  int | $offset |
  int | $limit |

Returns
  \eZ\Publish\API\Repository\Values\Content\ContentDraftList

}

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 1234 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\resolveUser().

## ◆ loadContentDrafts()

eZ\Publish\Core\Repository\ContentService::loadContentDrafts | ( | User | $user = `null` | ) |

Loads drafts for a user.

If no user is given the drafts for the authenticated user are returned

Parameters

  \eZ\Publish\API\Repository\Values\User\User | null | $user |

Returns
  \eZ\Publish\API\Repository\Values\Content\VersionInfo[] Drafts owned by the given user

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 1207 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\resolveUser().

## ◆ loadContentInfo()

eZ\Publish\Core\Repository\ContentService::loadContentInfo | ( |  | $contentId | ) |

Loads a content info object.

To load fields use loadContent

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 129 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\internalLoadContentInfo().

Referenced by eZ\Publish\Core\Repository\ContentService\createContentDraft(), and eZ\Publish\Core\Repository\ContentService\updateContentMetadata().

## ◆ loadContentInfoByRemoteId()

eZ\Publish\Core\Repository\ContentService::loadContentInfoByRemoteId | ( |  | $remoteId | ) |

Loads a content info object for the given remoteId.

To load fields use loadContent

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 197 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\internalLoadContentInfo().

Referenced by eZ\Publish\Core\Repository\ContentService\updateContentMetadata().

## ◆ loadContentInfoList()

eZ\Publish\Core\Repository\ContentService::loadContentInfoList | ( | array | $contentIds | ) |

{Bulk-load ContentInfo items by id's.Note: It does not throw exceptions on load, just skips erroneous (NotFound or Unauthorized) ContentInfo items.

Parameters

  int[] | $contentIds |

Returns
  \eZ\Publish\API\Repository\Values\Content\ContentInfo[] list of ContentInfo with Content Ids as keys

}

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 142 of file Core/Repository/ContentService.php.

## ◆ loadContentListByContentInfo()

eZ\Publish\Core\Repository\ContentService::loadContentListByContentInfo | ( | array | $contentInfoList,
|  | array | $languages = `[]`,
|  |  | $useAlwaysAvailable = `true`
| ) |  |

Bulk-load Content items by the list of ContentInfo Value Objects.

Note: it does not throw exceptions on load, just ignores erroneous Content item. Moreover, since the method works on pre-loaded ContentInfo list, it is assumed that user is allowed to access every Content on the list.

Parameters

  \eZ\Publish\API\Repository\Values\Content\ContentInfo[] | $contentInfoList |
  string[] | $languages | A language priority, filters returned fields and is used as prioritized language code on returned value object. If not given all languages are returned.
  bool | $useAlwaysAvailable | Add Main language to $languages if true (default) and if alwaysAvailable is true, unless all languages have been asked for.

Returns
  \eZ\Publish\API\Repository\Values\Content\Content[] list of Content items with Content Ids as keys

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 452 of file Core/Repository/ContentService.php.

References eZ\Publish\API\Repository\Values\Content\Language\ALL.

## ◆ loadRelations()

eZ\Publish\Core\Repository\ContentService::loadRelations | ( | APIVersionInfo | $versionInfo | ) |

Loads all outgoing relations for the given version.

Exceptions

Definition at line 2036 of file Core/Repository/ContentService.php.

## ◆ loadReverseRelationList()

eZ\Publish\Core\Repository\ContentService::loadReverseRelationList | ( | ContentInfo | $contentInfo,
|  | int | $offset = `0`,
|  | int | $limit = `-1`
| ) |  |

{Loads all incoming relations for a content object.The relations come only from published versions of the source content objects. If the user is not allowed to read specific version then UnauthorizedRelationListItem is returned \eZ\Publish\API\Repository\Values\Content\RelationList\Item\UnauthorizedRelationListItem

Parameters

  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $contentInfo |
  int | $offset |
  int | $limit |

Returns
  \eZ\Publish\API\Repository\Values\Content\RelationList

}

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2139 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\internalLoadContentInfo().

## ◆ loadReverseRelations()

eZ\Publish\Core\Repository\ContentService::loadReverseRelations | ( | ContentInfo | $contentInfo | ) |

Loads all incoming relations for a content object.

The relations come only from published versions of the source content objects

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2109 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\internalLoadContentInfo().

## ◆ loadVersionInfo()

eZ\Publish\Core\Repository\ContentService::loadVersionInfo | ( | ContentInfo | $contentInfo,
|  |  | $versionNo = `null`
| ) |  |

Loads a version info of the given content object.

If no version number is given, the method returns the current version

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 221 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\loadVersionInfoById().

## ◆ loadVersionInfoById()

eZ\Publish\Core\Repository\ContentService::loadVersionInfoById | ( |  | $contentId,
|  |  | $versionNo = `null`
| ) |  |

Loads a version info of the given content object id.

If no version number is given, the method returns the current version

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 239 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\addRelation(), eZ\Publish\Core\Repository\ContentService\createContentDraft(), eZ\Publish\Core\Repository\ContentService\deleteRelation(), and eZ\Publish\Core\Repository\ContentService\loadVersionInfo().

## ◆ loadVersions()

eZ\Publish\Core\Repository\ContentService::loadVersions | ( | ContentInfo | $contentInfo,
|  | ?int | $status = `null`
| ) |  |

Loads all versions for the given content.

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 1929 of file Core/Repository/ContentService.php.

References eZ\Publish\API\Repository\Values\Content\VersionInfo\STATUS_ARCHIVED, eZ\Publish\API\Repository\Values\Content\VersionInfo\STATUS_DRAFT, and eZ\Publish\API\Repository\Values\Content\VersionInfo\STATUS_PUBLISHED.

Referenced by eZ\Publish\Core\Repository\ContentService\deleteTranslation().

## ◆ mapFieldsForCreate()

eZ\Publish\Core\Repository\ContentService::mapFieldsForCreate | ( | APIContentCreateStruct | $contentCreateStruct | ) |
| protected

Returns an array of fields like $fields[$field->fieldDefIdentifier][$field->languageCode].

Exceptions

Definition at line 788 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\cloneField().

## ◆ mapFieldsForUpdate()

eZ\Publish\Core\Repository\ContentService::mapFieldsForUpdate | ( | APIContentUpdateStruct | $contentUpdateStruct,
|  | ContentType | $contentType,
|  |  | $mainLanguageCode
| ) |  |
| protected

Returns an array of fields like $fields[$field->fieldDefIdentifier][$field->languageCode].

Exceptions

Definition at line 1557 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\cloneField(), and eZ\Publish\API\Repository\Values\ContentType\ContentType\getFieldDefinition().

## ◆ newContentCreateStruct()

eZ\Publish\Core\Repository\ContentService::newContentCreateStruct | ( | ContentType | $contentType,
|  |  | $mainLanguageCode
| ) |  |

Instantiates a new content create struct object.

alwaysAvailable is set to the ContentType's defaultAlwaysAvailable

Parameters

  \eZ\Publish\API\Repository\Values\ContentType\ContentType | $contentType |
  string | $mainLanguageCode |

Returns
  \eZ\Publish\API\Repository\Values\Content\ContentCreateStruct

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2568 of file Core/Repository/ContentService.php.

## ◆ newContentMetadataUpdateStruct()

eZ\Publish\Core\Repository\ContentService::newContentMetadataUpdateStruct | ( |  | ) |

Instantiates a new content meta data update struct.

Returns
  \eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2584 of file Core/Repository/ContentService.php.

## ◆ newContentUpdateStruct()

eZ\Publish\Core\Repository\ContentService::newContentUpdateStruct | ( |  | ) |

Instantiates a new content update struct.

Returns
  \eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2594 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\copyTranslationsFromPublishedVersion().

## ◆ publishUrlAliasesForContent()

eZ\Publish\Core\Repository\ContentService::publishUrlAliasesForContent | ( | APIContent | $content,
|  |  | $updatePathIdentificationString = `true`
| ) |  |
| protected

Publishes URL aliases for all locations of a given content.

Parameters

  \eZ\Publish\API\Repository\Values\Content\Content | $content |
  bool | $updatePathIdentificationString | this parameter is legacy storage specific for updating ezcontentobject_tree.path_identification_string, it is ignored by other storage engines

Definition at line 1005 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\internalPublishVersion(), and eZ\Publish\Core\Repository\ContentService\updateContentMetadata().

## ◆ publishVersion()

eZ\Publish\Core\Repository\ContentService::publishVersion | ( | APIVersionInfo | $versionInfo,
|  | array | $translations = `Language::ALL`
| ) |  |

Publishes a content version.

Publishes a content version and deletes archive versions if they overflow max archive versions. Max archive versions are currently a configuration, but might be moved to be a param of ContentType in the future.

Parameters

  \eZ\Publish\API\Repository\Values\Content\VersionInfo | $versionInfo |
  string[] | $translations |

Returns
  \eZ\Publish\API\Repository\Values\Content\Content

Exceptions

Definition at line 1612 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\copyTranslationsFromPublishedVersion(), eZ\Publish\Core\Repository\ContentService\internalLoadContent(), and eZ\Publish\Core\Repository\ContentService\internalPublishVersion().

## ◆ removeTranslation()

eZ\Publish\Core\Repository\ContentService::removeTranslation | ( | ContentInfo | $contentInfo,
|  |  | $languageCode
| ) |  |

{Remove Content Object translation from all Versions (including archived ones) of a Content Object.NOTE: this operation is risky and permanent, so user interface (ideally CLI) should provide a warning before performing it.

Deprecated:
  since 6.13, use {

See also
  deleteTranslation} instead

Exceptions

}

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2297 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\deleteTranslation().

## ◆ resolveUser()

eZ\Publish\Core\Repository\ContentService::resolveUser | ( | ?User | $user | ) |
| private

Parameters

  \eZ\Publish\API\Repository\Values\User\User | null | $user |

Returns
  \eZ\Publish\API\Repository\Values\User\UserReference

Definition at line 2604 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\countContentDrafts(), eZ\Publish\Core\Repository\ContentService\loadContentDraftList(), and eZ\Publish\Core\Repository\ContentService\loadContentDrafts().

## ◆ revealContent()

eZ\Publish\Core\Repository\ContentService::revealContent | ( | ContentInfo | $contentInfo | ) |

Reveals Content hidden by hideContent API.

Locations which were hidden before hiding Content will remain hidden.

See also
  hideContent

Parameters

  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $contentInfo |

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 2532 of file Core/Repository/ContentService.php.

## ◆ updateContentMetadata()

eZ\Publish\Core\Repository\ContentService::updateContentMetadata | ( | ContentInfo | $contentInfo,
|  | ContentMetadataUpdateStruct | $contentMetadataUpdateStruct
| ) |  |

Updates the metadata.

(see ContentMetadataUpdateStruct) of a content object - to update fields use updateContent

Exceptions

Implements eZ\Publish\API\Repository\ContentService.

Definition at line 910 of file Core/Repository/ContentService.php.

References eZ\Publish\Core\Repository\ContentService\loadContent(), eZ\Publish\Core\Repository\ContentService\loadContentInfo(), eZ\Publish\Core\Repository\ContentService\loadContentInfoByRemoteId(), and eZ\Publish\Core\Repository\ContentService\publishUrlAliasesForContent().

## Member Data Documentation

## ◆ $domainMapper

eZ\Publish\Core\Repository\ContentService::$domainMapper
| protected

Definition at line 72 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\__construct().

## ◆ $fieldTypeRegistry

eZ\Publish\Core\Repository\ContentService::$fieldTypeRegistry
| protected

Definition at line 81 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\__construct().

## ◆ $nameSchemaService

eZ\Publish\Core\Repository\ContentService::$nameSchemaService
| protected

Definition at line 78 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\__construct().

## ◆ $persistenceHandler

eZ\Publish\Core\Repository\ContentService::$persistenceHandler
| protected

Definition at line 66 of file Core/Repository/ContentService.php.

## ◆ $relationProcessor

eZ\Publish\Core\Repository\ContentService::$relationProcessor
| protected

Definition at line 75 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\__construct().

## ◆ $repository

eZ\Publish\Core\Repository\ContentService::$repository
| protected

Definition at line 63 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\__construct().

## ◆ $settings

eZ\Publish\Core\Repository\ContentService::$settings
| protected

Definition at line 69 of file Core/Repository/ContentService.php.

Referenced by eZ\Publish\Core\Repository\ContentService\__construct().

The documentation for this class was generated from the following file:

- Core/Repository/ContentService.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.