PHP Класс eZ\Publish\Core\REST\Client\ContentService

Наследование: implements eZ\Publish\API\Repository\ContentService, implements eZ\Publish\Core\REST\Client\Sessionable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( eZ\Publish\Core\REST\Client\HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, eZ\Publish\Core\REST\Common\RequestParser $requestParser, ContentTypeService $contentTypeService )
addRelation ( eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion, eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent ) : eZ\Publish\API\Repository\Values\Content\Relation Adds a relation of type common.
addTranslationInfo ( eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo ) Adds translation information to the content object.
copyContent ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $destinationLocationCreateStruct, eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo = null ) : eZ\Publish\API\Repository\Values\Content\Content Copies the content to a new location. If no version is given, all versions are copied, otherwise only the given version.
createContent ( eZ\Publish\API\Repository\Values\Content\ContentCreateStruct $contentCreateStruct, array $locationCreateStructs = [] ) : eZ\Publish\API\Repository\Values\Content\Content Creates a new content draft assigned to the authenticated user.
createContentDraft ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo = null, eZ\Publish\API\Repository\Values\User\User $user = null ) : eZ\Publish\API\Repository\Values\Content\Content Creates a draft from a published or archived version.
deleteContent ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo ) Deletes a content object including all its versions and locations including their subtrees.
deleteRelation ( eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion, eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent ) Removes a relation of type COMMON from a draft.
deleteVersion ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo ) Removes the given version.
findContent ( eZ\Publish\API\Repository\Values\Content\Query $query, array $languageFilter, boolean $filterOnUserPermissions = true ) : eZ\Publish\API\Repository\Values\Content\SearchResult Finds content objects for the given query.
findSingle ( eZ\Publish\API\Repository\Values\Content\Query $query, array $languageFilter, boolean $filterOnUserPermissions = true ) : eZ\Publish\API\Repository\Values\Content\Content Performs a query for a single content object.
loadContent ( integer $contentId, array $languages = null, integer $versionNo = null, boolean $useAlwaysAvailable = true ) : eZ\Publish\API\Repository\Values\Content\Content Loads content in a version of the given content object.
loadContentByContentInfo ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, array $languages = null, integer $versionNo = null, boolean $useAlwaysAvailable = true ) : eZ\Publish\API\Repository\Values\Content\Content Loads content in a version for the given content info object.
loadContentByRemoteId ( string $remoteId, array $languages = null, integer $versionNo = null, boolean $useAlwaysAvailable = true ) : eZ\Publish\API\Repository\Values\Content\Content Loads content in a version for the content object reference by the given remote id.
loadContentByVersionInfo ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo, array $languages = null, boolean $useAlwaysAvailable = true ) : eZ\Publish\API\Repository\Values\Content\Content Loads content in the version given by version info.
loadContentDrafts ( eZ\Publish\API\Repository\Values\User\User $user = null ) : eZ\Publish\API\Repository\Values\Content\VersionInfo Loads drafts for a user.
loadContentInfo ( integer $contentId ) : eZ\Publish\API\Repository\Values\Content\ContentInfo Loads a content info object.
loadContentInfoByRemoteId ( string $remoteId ) : eZ\Publish\API\Repository\Values\Content\ContentInfo Loads a content info object for the given remoteId.
loadRelations ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo ) : eZ\Publish\API\Repository\Values\Content\Relation[] Loads all outgoing relations for the given version.
loadReverseRelations ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo ) : eZ\Publish\API\Repository\Values\Content\Relation[] Loads all incoming relations for a content object.
loadTranslationInfos ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, array $filter = [] ) : eZ\Publish\API\Repository\Values\Content\TranslationInfo[] lists the translations done on this content object.
loadVersionInfo ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, integer $versionNo = null ) : eZ\Publish\API\Repository\Values\Content\VersionInfo Loads a version info of the given content object.
loadVersionInfoById ( mixed $contentId, integer $versionNo = null ) : eZ\Publish\API\Repository\Values\Content\VersionInfo Loads a version info of the given content object id.
loadVersions ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo ) : eZ\Publish\API\Repository\Values\Content\VersionInfo[] Loads all versions for the given content.
newContentCreateStruct ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType, string $mainLanguageCode ) : eZ\Publish\API\Repository\Values\Content\ContentCreateStruct Instantiates a new content create struct object.
newContentMetadataUpdateStruct ( ) : eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct Instantiates a new content meta data update struct.
newContentUpdateStruct ( ) : eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct Instantiates a new content update struct.
newTranslationInfo ( ) : eZ\Publish\API\Repository\Values\Content\TranslationInfo Instantiates a new TranslationInfo object.
newTranslationValues ( ) : eZ\Publish\API\Repository\Values\Content\TranslationValues Instantiates a Translation object.
publishVersion ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo ) : eZ\Publish\API\Repository\Values\Content\Content Publishes a content version.
setSession ( mixed $id ) Set session ID.
translateVersion ( eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo, eZ\Publish\API\Repository\Values\Content\TranslationValues $translationValues, eZ\Publish\API\Repository\Values\User\User $user = null ) : eZ\Publish\API\Repository\Values\Content\Content Translate a version.
updateContent ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo, eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct $contentUpdateStruct ) : eZ\Publish\API\Repository\Values\Content\Content Updates the fields of a draft.
updateContentMetadata ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct $contentMetadataUpdateStruct ) : eZ\Publish\API\Repository\Values\Content\Content Updates the metadata.

Защищенные методы

Метод Описание
completeContentInfo ( Values\RestContentInfo $restContentInfo ) : ContentInfo Returns a complete ContentInfo based on $restContentInfo.
fetchCurrentVersionUrl ( string $currentVersionReference ) : string Returns the URL of the current version referenced by $currentVersionReference.
isErrorResponse ( Message $response ) : boolean Checks if the given response is an error.

Описание методов

__construct() публичный Метод

public __construct ( eZ\Publish\Core\REST\Client\HttpClient $client, Dispatcher $inputDispatcher, Visitor $outputVisitor, eZ\Publish\Core\REST\Common\RequestParser $requestParser, ContentTypeService $contentTypeService )
$client eZ\Publish\Core\REST\Client\HttpClient
$inputDispatcher eZ\Publish\Core\REST\Common\Input\Dispatcher
$outputVisitor eZ\Publish\Core\REST\Common\Output\Visitor
$requestParser eZ\Publish\Core\REST\Common\RequestParser
$contentTypeService ContentTypeService

addRelation() публичный Метод

Adds a relation of type common.
public addRelation ( eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion, eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent ) : eZ\Publish\API\Repository\Values\Content\Relation
$sourceVersion eZ\Publish\API\Repository\Values\Content\VersionInfo
$destinationContent eZ\Publish\API\Repository\Values\Content\ContentInfo the destination of the relation
Результат eZ\Publish\API\Repository\Values\Content\Relation the newly created relation

addTranslationInfo() публичный Метод

Adds translation information to the content object.
С версии: 5.0
public addTranslationInfo ( eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo )
$translationInfo eZ\Publish\API\Repository\Values\Content\TranslationInfo

completeContentInfo() защищенный Метод

Returns a complete ContentInfo based on $restContentInfo.
protected completeContentInfo ( Values\RestContentInfo $restContentInfo ) : ContentInfo
$restContentInfo Values\RestContentInfo
Результат eZ\Publish\Core\REST\Client\Values\Content\ContentInfo

copyContent() публичный Метод

Copies the content to a new location. If no version is given, all versions are copied, otherwise only the given version.
public copyContent ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $destinationLocationCreateStruct, eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo = null ) : eZ\Publish\API\Repository\Values\Content\Content
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
$destinationLocationCreateStruct eZ\Publish\API\Repository\Values\Content\LocationCreateStruct the target location where the content is copied to
$versionInfo eZ\Publish\API\Repository\Values\Content\VersionInfo
Результат eZ\Publish\API\Repository\Values\Content\Content

createContent() публичный Метод

If a different userId is given in $contentCreateStruct it is assigned to the given user but this required special rights for the authenticated user (this is useful for content staging where the transfer process does not have to authenticate with the user which created the content object in the source server). The user has to publish the draft if it should be visible. In 4.x at least one location has to be provided in the location creation array.
public createContent ( eZ\Publish\API\Repository\Values\Content\ContentCreateStruct $contentCreateStruct, array $locationCreateStructs = [] ) : eZ\Publish\API\Repository\Values\Content\Content
$contentCreateStruct eZ\Publish\API\Repository\Values\Content\ContentCreateStruct
$locationCreateStructs array For each location parent under which a location should be created for the content
Результат eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft

createContentDraft() публичный Метод

If no version is given, the current published version is used. 4.x: The draft is created with the initialLanguage code of the source version or if not present with the main language. It can be changed on updating the version.
public createContentDraft ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo = null, eZ\Publish\API\Repository\Values\User\User $user = null ) : eZ\Publish\API\Repository\Values\Content\Content
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
$versionInfo eZ\Publish\API\Repository\Values\Content\VersionInfo
$user eZ\Publish\API\Repository\Values\User\User if set given user is used to create the draft - otherwise the current user is used
Результат eZ\Publish\API\Repository\Values\Content\Content - the newly created content draft

deleteContent() публичный Метод

Deletes a content object including all its versions and locations including their subtrees.
public deleteContent ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo )
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo

deleteRelation() публичный Метод

Removes a relation of type COMMON from a draft.
public deleteRelation ( eZ\Publish\API\Repository\Values\Content\VersionInfo $sourceVersion, eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContent )
$sourceVersion eZ\Publish\API\Repository\Values\Content\VersionInfo
$destinationContent eZ\Publish\API\Repository\Values\Content\ContentInfo

deleteVersion() публичный Метод

Removes the given version.
public deleteVersion ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo )
$versionInfo eZ\Publish\API\Repository\Values\Content\VersionInfo

fetchCurrentVersionUrl() защищенный Метод

Returns the URL of the current version referenced by $currentVersionReference.
protected fetchCurrentVersionUrl ( string $currentVersionReference ) : string
$currentVersionReference string
Результат string

findContent() публичный Метод

Finds content objects for the given query.
public findContent ( eZ\Publish\API\Repository\Values\Content\Query $query, array $languageFilter, boolean $filterOnUserPermissions = true ) : eZ\Publish\API\Repository\Values\Content\SearchResult
$query eZ\Publish\API\Repository\Values\Content\Query
$languageFilter array Configuration for specifying prioritized languages query will be performed on. Currently supported: array("languages" => array(,..)).
$filterOnUserPermissions boolean if true only the objects which is the user allowed to read are returned.
Результат eZ\Publish\API\Repository\Values\Content\SearchResult

findSingle() публичный Метод

Performs a query for a single content object.
public findSingle ( eZ\Publish\API\Repository\Values\Content\Query $query, array $languageFilter, boolean $filterOnUserPermissions = true ) : eZ\Publish\API\Repository\Values\Content\Content
$query eZ\Publish\API\Repository\Values\Content\Query
$languageFilter array Configuration for specifying prioritized languages query will be performed on. Currently supported: array("languages" => array(,..)).
$filterOnUserPermissions boolean if true only the objects which is the user allowed to read are returned.
Результат eZ\Publish\API\Repository\Values\Content\Content

isErrorResponse() защищенный Метод

Checks if the given response is an error.
protected isErrorResponse ( Message $response ) : boolean
$response eZ\Publish\Core\REST\Common\Message
Результат boolean

loadContent() публичный Метод

If no version number is given, the method returns the current version
public loadContent ( integer $contentId, array $languages = null, integer $versionNo = null, boolean $useAlwaysAvailable = true ) : eZ\Publish\API\Repository\Values\Content\Content
$contentId integer
$languages array A language filter for fields. If not given all languages are returned
$versionNo integer the version number. If not given the current version is returned
$useAlwaysAvailable boolean Add Main language to \$languages if true (default) and if alwaysAvailable is true
Результат eZ\Publish\API\Repository\Values\Content\Content

loadContentByContentInfo() публичный Метод

If no version number is given, the method returns the current version
public loadContentByContentInfo ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, array $languages = null, integer $versionNo = null, boolean $useAlwaysAvailable = true ) : eZ\Publish\API\Repository\Values\Content\Content
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
$languages array A language filter for fields. If not given all languages are returned
$versionNo integer the version number. If not given the current version is returned
$useAlwaysAvailable boolean Add Main language to \$languages if true (default) and if alwaysAvailable is true
Результат eZ\Publish\API\Repository\Values\Content\Content

loadContentByRemoteId() публичный Метод

If no version is given, the method returns the current version
public loadContentByRemoteId ( string $remoteId, array $languages = null, integer $versionNo = null, boolean $useAlwaysAvailable = true ) : eZ\Publish\API\Repository\Values\Content\Content
$remoteId string
$languages array A language filter for fields. If not given all languages are returned
$versionNo integer the version number. If not given the current version is returned
$useAlwaysAvailable boolean Add Main language to \$languages if true (default) and if alwaysAvailable is true
Результат eZ\Publish\API\Repository\Values\Content\Content

loadContentByVersionInfo() публичный Метод

Loads content in the version given by version info.
public loadContentByVersionInfo ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo, array $languages = null, boolean $useAlwaysAvailable = true ) : eZ\Publish\API\Repository\Values\Content\Content
$versionInfo eZ\Publish\API\Repository\Values\Content\VersionInfo
$languages array A language filter for fields. If not given all languages are returned
$useAlwaysAvailable boolean Add Main language to \$languages if true (default) and if alwaysAvailable is true
Результат eZ\Publish\API\Repository\Values\Content\Content

loadContentDrafts() публичный Метод

If no user is given the drafts for the authenticated user a returned
public loadContentDrafts ( eZ\Publish\API\Repository\Values\User\User $user = null ) : eZ\Publish\API\Repository\Values\Content\VersionInfo
$user eZ\Publish\API\Repository\Values\User\User
Результат eZ\Publish\API\Repository\Values\Content\VersionInfo the drafts ({@link VersionInfo}) owned by the given user

loadContentInfo() публичный Метод

To load fields use loadContent
public loadContentInfo ( integer $contentId ) : eZ\Publish\API\Repository\Values\Content\ContentInfo
$contentId integer
Результат eZ\Publish\API\Repository\Values\Content\ContentInfo

loadContentInfoByRemoteId() публичный Метод

To load fields use loadContent
public loadContentInfoByRemoteId ( string $remoteId ) : eZ\Publish\API\Repository\Values\Content\ContentInfo
$remoteId string
Результат eZ\Publish\API\Repository\Values\Content\ContentInfo

loadRelations() публичный Метод

Loads all outgoing relations for the given version.
public loadRelations ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo ) : eZ\Publish\API\Repository\Values\Content\Relation[]
$versionInfo eZ\Publish\API\Repository\Values\Content\VersionInfo
Результат eZ\Publish\API\Repository\Values\Content\Relation[]

loadReverseRelations() публичный Метод

The relations come only from published versions of the source content objects
public loadReverseRelations ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo ) : eZ\Publish\API\Repository\Values\Content\Relation[]
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
Результат eZ\Publish\API\Repository\Values\Content\Relation[]

loadTranslationInfos() публичный Метод

lists the translations done on this content object.
С версии: 5.0
public loadTranslationInfos ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, array $filter = [] ) : eZ\Publish\API\Repository\Values\Content\TranslationInfo[]
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
$filter array
Результат eZ\Publish\API\Repository\Values\Content\TranslationInfo[]

loadVersionInfo() публичный Метод

If no version number is given, the method returns the current version
public loadVersionInfo ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, integer $versionNo = null ) : eZ\Publish\API\Repository\Values\Content\VersionInfo
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
$versionNo integer the version number. If not given the current version is returned.
Результат eZ\Publish\API\Repository\Values\Content\VersionInfo

loadVersionInfoById() публичный Метод

If no version number is given, the method returns the current version
public loadVersionInfoById ( mixed $contentId, integer $versionNo = null ) : eZ\Publish\API\Repository\Values\Content\VersionInfo
$contentId mixed
$versionNo integer the version number. If not given the current version is returned.
Результат eZ\Publish\API\Repository\Values\Content\VersionInfo

loadVersions() публичный Метод

Loads all versions for the given content.
public loadVersions ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo ) : eZ\Publish\API\Repository\Values\Content\VersionInfo[]
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
Результат eZ\Publish\API\Repository\Values\Content\VersionInfo[] Sorted by creation date

newContentCreateStruct() публичный Метод

Instantiates a new content create struct object.
public newContentCreateStruct ( eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType, string $mainLanguageCode ) : eZ\Publish\API\Repository\Values\Content\ContentCreateStruct
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType
$mainLanguageCode string
Результат eZ\Publish\API\Repository\Values\Content\ContentCreateStruct

newContentMetadataUpdateStruct() публичный Метод

Instantiates a new content meta data update struct.
public newContentMetadataUpdateStruct ( ) : eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct
Результат eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct

newContentUpdateStruct() публичный Метод

Instantiates a new content update struct.
public newContentUpdateStruct ( ) : eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct
Результат eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct

newTranslationInfo() публичный Метод

Instantiates a new TranslationInfo object.
public newTranslationInfo ( ) : eZ\Publish\API\Repository\Values\Content\TranslationInfo
Результат eZ\Publish\API\Repository\Values\Content\TranslationInfo

newTranslationValues() публичный Метод

Instantiates a Translation object.
public newTranslationValues ( ) : eZ\Publish\API\Repository\Values\Content\TranslationValues
Результат eZ\Publish\API\Repository\Values\Content\TranslationValues

publishVersion() публичный Метод

Publishes a content version.
public publishVersion ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo ) : eZ\Publish\API\Repository\Values\Content\Content
$versionInfo eZ\Publish\API\Repository\Values\Content\VersionInfo
Результат eZ\Publish\API\Repository\Values\Content\Content

setSession() публичный Метод

Only for testing
public setSession ( mixed $id )
$id mixed

translateVersion() публичный Метод

updates the destination version given in $translationInfo with the provided translated fields in $translationValues
С версии: 5.0
public translateVersion ( eZ\Publish\API\Repository\Values\Content\TranslationInfo $translationInfo, eZ\Publish\API\Repository\Values\Content\TranslationValues $translationValues, eZ\Publish\API\Repository\Values\User\User $user = null ) : eZ\Publish\API\Repository\Values\Content\Content
$translationInfo eZ\Publish\API\Repository\Values\Content\TranslationInfo
$translationValues eZ\Publish\API\Repository\Values\Content\TranslationValues
$user eZ\Publish\API\Repository\Values\User\User If set, this user is taken as modifier of the version
Результат eZ\Publish\API\Repository\Values\Content\Content the content draft with the translated fields

updateContent() публичный Метод

Updates the fields of a draft.
public updateContent ( eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo, eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct $contentUpdateStruct ) : eZ\Publish\API\Repository\Values\Content\Content
$versionInfo eZ\Publish\API\Repository\Values\Content\VersionInfo
$contentUpdateStruct eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct
Результат eZ\Publish\API\Repository\Values\Content\Content the content draft with the updated fields

updateContentMetadata() публичный Метод

(see {@link ContentMetadataUpdateStruct}) of a content object - to update fields use updateContent
public updateContentMetadata ( eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo, eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct $contentMetadataUpdateStruct ) : eZ\Publish\API\Repository\Values\Content\Content
$contentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
$contentMetadataUpdateStruct eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct
Результат eZ\Publish\API\Repository\Values\Content\Content the content with the updated attributes