eZPublishCommunityProject  2012.12
eZ\Publish\Core\SignalSlot\ContentService Class Reference
+ Inheritance diagram for eZ\Publish\Core\SignalSlot\ContentService:
+ Collaboration diagram for eZ\Publish\Core\SignalSlot\ContentService:

Public Member Functions

 __construct (ContentServiceInterface $service, SignalDispatcher $signalDispatcher)
 Constructor. More...
 
 addRelation (VersionInfo $sourceVersion, ContentInfo $destinationContent)
 Adds a relation of type common. More...
 
 addTranslationInfo (TranslationInfo $translationInfo)
 
 copyContent (ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, VersionInfo $versionInfo=null)
 Copies the content to a new location. More...
 
 createContent (ContentCreateStruct $contentCreateStruct, array $locationCreateStructs=array())
 Creates a new content draft assigned to the authenticated user. More...
 
 createContentDraft (ContentInfo $contentInfo, VersionInfo $versionInfo=null, User $user=null)
 Creates a draft from a published or archived version. More...
 
 deleteContent (ContentInfo $contentInfo)
 Deletes a content object including all its versions and locations including their subtrees. More...
 
 deleteRelation (VersionInfo $sourceVersion, ContentInfo $destinationContent)
 Removes a relation of type COMMON from a draft. More...
 
 deleteVersion (VersionInfo $versionInfo)
 removes the given version More...
 
 loadContent ($contentId, array $languages=null, $versionNo=null)
 Loads content in a version of the given content object. More...
 
 loadContentByContentInfo (ContentInfo $contentInfo, array $languages=null, $versionNo=null)
 Loads content in a version for the given content info object. More...
 
 loadContentByRemoteId ($remoteId, array $languages=null, $versionNo=null)
 Loads content in a version for the content object reference by the given remote id. More...
 
 loadContentByVersionInfo (VersionInfo $versionInfo, array $languages=null)
 Loads content in the version given by version info. More...
 
 loadContentDrafts (User $user=null)
 Loads drafts for a user. More...
 
 loadContentInfo ($contentId)
 Loads a content info object. More...
 
 loadContentInfoByRemoteId ($remoteId)
 Loads a content info object for the given remoteId. More...
 
 loadRelations (VersionInfo $versionInfo)
 Loads all outgoing relations for the given version. More...
 
 loadReverseRelations (ContentInfo $contentInfo)
 Loads all incoming relations for a content object. More...
 
 loadTranslationInfos (ContentInfo $contentInfo, array $filter=array())
 lists the translations done on this content object 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...
 
 loadVersions (ContentInfo $contentInfo)
 Loads all versions for the given content. 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...
 
 newTranslationInfo ()
 Instantiates a new TranslationInfo object. More...
 
 newTranslationValues ()
 Instantiates a Translation object. More...
 
 publishVersion (VersionInfo $versionInfo)
 Publishes a content version. More...
 
 translateVersion (TranslationInfo $translationInfo, TranslationValues $translationValues, User $user=null)
 
 updateContent (VersionInfo $versionInfo, ContentUpdateStruct $contentUpdateStruct)
 Updates the fields of a draft. More...
 
 updateContentMetadata (ContentInfo $contentInfo, ContentMetadataUpdateStruct $contentMetadataUpdateStruct)
 Updates the metadata. More...
 

Protected Attributes

 $service
 
 $signalDispatcher
 

Constructor & Destructor Documentation

eZ\Publish\Core\SignalSlot\ContentService::__construct ( ContentServiceInterface  $service,
SignalDispatcher  $signalDispatcher 
)

Constructor.

Construct service object from aggregated service and signal dispatcher

Parameters
\eZ\Publish\API\Repository\ContentService$service
\eZ\Publish\Core\SignalSlot\SignalDispatcher$signalDispatcher

Member Function Documentation

eZ\Publish\Core\SignalSlot\ContentService::addRelation ( VersionInfo  $sourceVersion,
ContentInfo  $destinationContent 
)

Adds a relation of type common.

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to edit this version
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionif the version is not a draft
Parameters
\eZ\Publish\API\Repository\Values\Content\VersionInfo$sourceVersion
\eZ\Publish\API\Repository\Values\Content\ContentInfo$destinationContentthe destination of the relation
Returns
the newly created relation

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::addTranslationInfo ( TranslationInfo  $translationInfo)
eZ\Publish\Core\SignalSlot\ContentService::copyContent ( ContentInfo  $contentInfo,
LocationCreateStruct  $destinationLocationCreateStruct,
VersionInfo  $versionInfo = null 
)

Copies the content to a new location.

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to copy the content to the given location
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
\eZ\Publish\API\Repository\Values\Content\LocationCreateStruct$destinationLocationCreateStructthe target location where the content is copied to
\eZ\Publish\API\Repository\Values\Content\VersionInfo$versionInfo
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::createContent ( ContentCreateStruct  $contentCreateStruct,
array  $locationCreateStructs = array() 
)

Creates a new content draft assigned to the authenticated user.

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.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to create the content in the given location
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif there is a provided remoteId which exists in the system or there is no location provided (4.x) or multiple locations are under the same parent or if the a field value is not accepted by the field type
\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationExceptionif a field in the $contentCreateStruct is not valid
\eZ\Publish\API\Repository\Exceptions\ContentValidationExceptionif a required field is missing or is set to an empty value
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentCreateStruct$contentCreateStruct
\eZ\Publish\API\Repository\Values\Content\LocationCreateStruct[]$locationCreateStructs For each location parent under which a location should be created for the content
Returns
- the newly created content draft

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::createContentDraft ( ContentInfo  $contentInfo,
VersionInfo  $versionInfo = null,
User  $user = null 
)

Creates a draft from a published or archived version.

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.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to create the draft
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
\eZ\Publish\API\Repository\Values\Content\VersionInfo$versionInfo
\eZ\Publish\API\Repository\Values\User\User$userif set given user is used to create the draft - otherwise the current user is used
Returns
- the newly created content draft

Implements eZ\Publish\API\Repository\ContentService.

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

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to delete the content (in one of the locations of the given content object)
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::deleteRelation ( VersionInfo  $sourceVersion,
ContentInfo  $destinationContent 
)

Removes a relation of type COMMON from a draft.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed edit this version
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionif the version is not a draft
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif there is no relation of type COMMON for the given destination
Parameters
\eZ\Publish\API\Repository\Values\Content\VersionInfo$sourceVersion
\eZ\Publish\API\Repository\Values\Content\ContentInfo$destinationContent

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::deleteVersion ( VersionInfo  $versionInfo)

removes the given version

Exceptions
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionif the version is in state published
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to remove this version
Parameters
\eZ\Publish\API\Repository\Values\Content\VersionInfo$versionInfo

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadContent (   $contentId,
array  $languages = null,
  $versionNo = null 
)

Loads content in a version of the given content object.

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionif the content or version with the given id and languages does not exist
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to load this version
Parameters
int$contentId
array$languagesA language filter for fields. If not given all languages are returned
int$versionNothe version number. If not given the current version is returned.
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadContentByContentInfo ( ContentInfo  $contentInfo,
array  $languages = null,
  $versionNo = null 
)

Loads content in a version for the given content info object.

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundException- if version with the given number does not exist
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to load this version
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
array$languagesA language filter for fields. If not given all languages are returned
int$versionNothe version number. If not given the current version is returned.
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadContentByRemoteId (   $remoteId,
array  $languages = null,
  $versionNo = null 
)

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
\eZ\Publish\API\Repository\Exceptions\NotFoundException- if the content or version with the given remote id does not exist
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to load this version
Parameters
string$remoteId
array$languagesA language filter for fields. If not given all languages are returned
int$versionNothe version number. If not given the current version is returned.
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadContentByVersionInfo ( VersionInfo  $versionInfo,
array  $languages = null 
)

Loads content in the version given by version info.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to load this version
Parameters
\eZ\Publish\API\Repository\Values\Content\VersionInfo$versionInfo
array$languagesA language filter for fields. If not given all languages are returned
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadContentDrafts ( User  $user = null)

Loads drafts for a user.

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to load the draft list
Parameters
\eZ\Publish\API\Repository\Values\User\User$user
Returns
[] the drafts (VersionInfo) owned by the given user

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadContentInfo (   $contentId)

Loads a content info object.

To load fields use loadContent

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to read the content
\eZ\Publish\API\Repository\Exceptions\NotFoundException- if the content with the given id does not exist
Parameters
int$contentId
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadContentInfoByRemoteId (   $remoteId)

Loads a content info object for the given remoteId.

To load fields use loadContent

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to read the content
\eZ\Publish\API\Repository\Exceptions\NotFoundException- if the content with the given remote id does not exist
Parameters
string$remoteId
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadRelations ( VersionInfo  $versionInfo)

Loads all outgoing relations for the given version.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to read this version
Parameters
\eZ\Publish\API\Repository\Values\Content\VersionInfo$versionInfo
Returns
[]

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\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
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to read this version
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
Returns
[]

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadTranslationInfos ( ContentInfo  $contentInfo,
array  $filter = array() 
)

lists the translations done on this content object

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed read translation infos
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
array$filter
Todo:
TBD - filter by source version, destination version and languages
Returns
[]
Since
5.0

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\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
\eZ\Publish\API\Repository\Exceptions\NotFoundException- if the version with the given number does not exist
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to load this version
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
int$versionNothe version number. If not given the current version is returned.
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\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
\eZ\Publish\API\Repository\Exceptions\NotFoundException- if the version with the given number does not exist
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to load this version
Parameters
int$contentId
int$versionNothe version number. If not given the current version is returned.
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::loadVersions ( ContentInfo  $contentInfo)

Loads all versions for the given content.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to list versions
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
Returns
[] Sorted by creation date

Implements eZ\Publish\API\Repository\ContentService.

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

Instantiates a new content create struct object.

Parameters
\eZ\Publish\API\Repository\Values\ContentType\ContentType$contentType
string$mainLanguageCode
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::newContentMetadataUpdateStruct ( )

Instantiates a new content meta data update struct.

Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::newContentUpdateStruct ( )

Instantiates a new content update struct.

Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::newTranslationInfo ( )

Instantiates a new TranslationInfo object.

Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::newTranslationValues ( )

Instantiates a Translation object.

Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::publishVersion ( VersionInfo  $versionInfo)

Publishes a content version.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to publish this version
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionif the version is not a draft
Parameters
\eZ\Publish\API\Repository\Values\Content\VersionInfo$versionInfo
Returns

Implements eZ\Publish\API\Repository\ContentService.

eZ\Publish\Core\SignalSlot\ContentService::translateVersion ( TranslationInfo  $translationInfo,
TranslationValues  $translationValues,
User  $user = null 
)
eZ\Publish\Core\SignalSlot\ContentService::updateContent ( VersionInfo  $versionInfo,
ContentUpdateStruct  $contentUpdateStruct 
)

Updates the fields of a draft.

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to update this version
\eZ\Publish\API\Repository\Exceptions\BadStateExceptionif the version is not a draft
\eZ\Publish\API\Repository\Exceptions\ContentFieldValidationExceptionif a field in the $contentUpdateStruct is not valid
\eZ\Publish\API\Repository\Exceptions\ContentValidationExceptionif a required field is set to an empty value
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif a field value is not accepted by the field type
Parameters
\eZ\Publish\API\Repository\Values\Content\VersionInfo$versionInfo
\eZ\Publish\API\Repository\Values\Content\ContentUpdateStruct$contentUpdateStruct
Returns
the content draft with the updated fields

Implements eZ\Publish\API\Repository\ContentService.

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

Updates the metadata.

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

Exceptions
\eZ\Publish\API\Repository\Exceptions\UnauthorizedExceptionif the user is not allowed to update the content meta data
\eZ\Publish\API\Repository\Exceptions\InvalidArgumentExceptionif the remoteId in $contentMetadataUpdateStruct is set but already exists
Parameters
\eZ\Publish\API\Repository\Values\Content\ContentInfo$contentInfo
\eZ\Publish\API\Repository\Values\Content\ContentMetadataUpdateStruct$contentMetadataUpdateStruct
Returns
the content with the updated attributes

Implements eZ\Publish\API\Repository\ContentService.

Member Data Documentation

eZ\Publish\Core\SignalSlot\ContentService::$service
protected
eZ\Publish\Core\SignalSlot\ContentService::$signalDispatcher
protected

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