eZPublishCommunityProject  2013.4
eZ\Publish\Core\Persistence\Legacy\Content\Handler Class Reference

The Content Handler stores Content and ContentType objects. More...

+ Inheritance diagram for eZ\Publish\Core\Persistence\Legacy\Content\Handler:
+ Collaboration diagram for eZ\Publish\Core\Persistence\Legacy\Content\Handler:

Public Member Functions

 __construct (Gateway $contentGateway, LocationGateway $locationGateway, Mapper $mapper, FieldHandler $fieldHandler, SlugConverter $slugConverter, UrlAliasGateway $urlAliasGateway)
 Creates a new content handler. More...
 
 addRelation (RelationCreateStruct $createStruct)
 Creates a relation between $sourceContentId in $sourceContentVersionNo and $destinationContentId with a specific $type. More...
 
 copy ($contentId, $versionNo=null)
 Copy Content with Fields and Versions from $contentId in $version. More...
 
 create (CreateStruct $struct)
 Creates a new Content entity in the storage engine. More...
 
 createDraftFromVersion ($contentId, $srcVersion, $userId)
 Creates a new draft version from $contentId in $version. More...
 
 deleteContent ($contentId)
 Deletes all versions and fields, all locations (subtree), and all relations. More...
 
 deleteVersion ($contentId, $versionNo)
 Deletes given version, its fields, node assignment, relations and names. More...
 
 listVersions ($contentId)
 Returns the versions for $contentId. More...
 
 load ($id, $version, $translations=null)
 Returns the raw data of a content object identified by $id, in a struct. More...
 
 loadContentInfo ($contentId)
 Returns the metadata object for a content identified by $contentId. More...
 
 loadDraftsForUser ($userId)
 Returns all versions with draft status created by the given $userId. More...
 
 loadRelations ($sourceContentId, $sourceContentVersionNo=null, $type=null)
 Loads relations from $sourceContentId. More...
 
 loadReverseRelations ($destinationContentId, $type=null)
 Loads relations from $contentId. More...
 
 loadVersionInfo ($contentId, $versionNo)
 Returns the version object for a content/version identified by $contentId and $versionNo. More...
 
 publish ($contentId, $versionNo, MetadataUpdateStruct $metaDataUpdateStruct)
 Performs the publishing operations required to set the version identified by $updateStruct->versionNo and $updateStruct->id as the published one. More...
 
 removeRawContent ($contentId)
 Deletes raw content data. More...
 
 removeRelation ($relationId, $type)
 Removes a relation by relation Id. More...
 
 setStatus ($contentId, $status, $version)
 Sets the status of object identified by $contentId and $version to $status. More...
 
 updateContent ($contentId, $versionNo, UpdateStruct $updateStruct)
 Updates a content version, identified by $contentId and $versionNo. More...
 
 updateMetadata ($contentId, MetadataUpdateStruct $content)
 Updates a content object meta data, identified by $contentId. More...
 
- Public Member Functions inherited from eZ\Publish\SPI\Persistence\Content\Handler
 updateContent ($contentId, $versionNo, UpdateStruct $content)
 Updates a content version, identified by $contentId and $versionNo. More...
 

Public Attributes

 $locationHandler
 

Protected Member Functions

 internalCreate (CreateStruct $struct, $versionNo=1)
 Creates a new Content entity in the storage engine. More...
 
 updatePathIdentificationString ($contentId, MetadataUpdateStruct $content)
 Updates path identification string for locations of given $contentId if main language is set in update struct. More...
 

Protected Attributes

 $contentGateway
 
 $fieldHandler
 
 $locationGateway
 
 $mapper
 
 $slugConverter
 
 $urlAliasGateway
 

Detailed Description

The Content Handler stores Content and ContentType objects.

Constructor & Destructor Documentation

eZ\Publish\Core\Persistence\Legacy\Content\Handler::__construct ( Gateway  $contentGateway,
LocationGateway  $locationGateway,
Mapper  $mapper,
FieldHandler  $fieldHandler,
SlugConverter  $slugConverter,
UrlAliasGateway  $urlAliasGateway 
)

Creates a new content handler.

Parameters
\eZ\Publish\Core\Persistence\Legacy\Content\Gateway$contentGateway
\eZ\Publish\Core\Persistence\Legacy\Content\Location\Gateway$locationGateway
\eZ\Publish\Core\Persistence\Legacy\Content\Mapper$mapper
\eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler$fieldHandler
\eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\SlugConverter$slugConverter
\eZ\Publish\Core\Persistence\Legacy\Content\UrlAlias\Gateway$urlAliasGateway

Member Function Documentation

eZ\Publish\Core\Persistence\Legacy\Content\Handler::addRelation ( RelationCreateStruct  $createStruct)

Creates a relation between $sourceContentId in $sourceContentVersionNo and $destinationContentId with a specific $type.

Todo:
Should the existence verifications happen here or is this supposed to be handled at a higher level?
Parameters
\eZ\Publish\SPI\Persistence\Content\Relation\CreateStruct$createStruct
Returns

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::copy (   $contentId,
  $versionNo = null 
)

Copy Content with Fields and Versions from $contentId in $version.

Copies all fields from $contentId in $versionNo (or all versions if null) to a new object which is returned. Version numbers are maintained.

Todo:
Should relations be copied? Which ones?
Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf content or version is not found
Parameters
mixed$contentId
mixed | null$versionNoCopy all versions if left null
Returns

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::create ( CreateStruct  $struct)

Creates a new Content entity in the storage engine.

The values contained inside the $content will form the basis of stored entity.

Will contain always a complete list of fields.

Parameters
\eZ\Publish\SPI\Persistence\Content\CreateStruct$structContent creation struct.
Returns
Content value object

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::createDraftFromVersion (   $contentId,
  $srcVersion,
  $userId 
)

Creates a new draft version from $contentId in $version.

Copies all fields from $contentId in $srcVersion and creates a new version of the referred Content from it.

Note: When creating a new draft in the old admin interface there will also be an entry in the eznode_assignment created for the draft. This is ignored in this implementation.

Parameters
mixed$contentId
mixed$srcVersion
mixed$userId
Returns

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::deleteContent (   $contentId)

Deletes all versions and fields, all locations (subtree), and all relations.

Removes the relations, but not the related objects. All subtrees of the assigned nodes of this content objects are removed (recursively).

Parameters
int$contentId
Returns
boolean

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::deleteVersion (   $contentId,
  $versionNo 
)

Deletes given version, its fields, node assignment, relations and names.

Removes the relations, but not the related objects.

Parameters
int$contentId
int$versionNo
Returns
boolean

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::internalCreate ( CreateStruct  $struct,
  $versionNo = 1 
)
protected

Creates a new Content entity in the storage engine.

The values contained inside the $content will form the basis of stored entity.

Will contain always a complete list of fields.

Parameters
\eZ\Publish\SPI\Persistence\Content\CreateStruct$structContent creation struct.
mixed$versionNoUsed by self::copy() to maintain version numbers
Returns
Content value object

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler\copy(), eZ\Publish\Core\Persistence\Legacy\Content\Handler\copy(), eZ\Publish\Core\Persistence\Legacy\Content\Handler\create(), eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler\create(), and eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler\createDraft().

eZ\Publish\Core\Persistence\Legacy\Content\Handler::listVersions (   $contentId)
eZ\Publish\Core\Persistence\Legacy\Content\Handler::load (   $id,
  $version,
  $translations = null 
)

Returns the raw data of a content object identified by $id, in a struct.

A version to load must be specified. If you want to load the current version of a content object use SearchHandler::findSingle() with the ContentId criterion.

Optionally a translation filter may be specified. If specified only the translations with the listed language codes will be retrieved. If not, all translations will be retrieved.

Parameters
int | string$id
int | string$version
string[]$translations
Returns
Content value object

Implements eZ\Publish\SPI\Persistence\Content\Handler.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler\copy(), eZ\Publish\Core\Persistence\Legacy\Content\Handler\copy(), eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler\createDraft(), eZ\Publish\Core\Persistence\Legacy\Content\Handler\createDraftFromVersion(), eZ\Publish\Core\Persistence\Legacy\Content\Handler\publish(), eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler\publish(), eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler\update(), and eZ\Publish\Core\Persistence\Legacy\Content\Handler\updateContent().

eZ\Publish\Core\Persistence\Legacy\Content\Handler::loadContentInfo (   $contentId)
eZ\Publish\Core\Persistence\Legacy\Content\Handler::loadDraftsForUser (   $userId)

Returns all versions with draft status created by the given $userId.

Parameters
int$userId
Returns
[]

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::loadRelations (   $sourceContentId,
  $sourceContentVersionNo = null,
  $type = null 
)

Loads relations from $sourceContentId.

Optionally, loads only those with $type and $sourceContentVersionNo.

Parameters
mixed$sourceContentIdSource Content ID
mixed | null$sourceContentVersionNoSource Content Version, null if not specified
int | null$type{
See Also
::COMMON, ::EMBED, ::LINK, ::FIELD}
Returns
[]

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::loadReverseRelations (   $destinationContentId,
  $type = null 
)

Loads relations from $contentId.

Optionally, loads only those with $type.

Only loads relations against published versions.

Parameters
mixed$destinationContentIdDestination Content ID
int | null$type{
See Also
::COMMON, ::EMBED, ::LINK, ::FIELD}
Returns
[]

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::loadVersionInfo (   $contentId,
  $versionNo 
)

Returns the version object for a content/version identified by $contentId and $versionNo.

Exceptions
\eZ\Publish\API\Repository\Exceptions\NotFoundExceptionIf version is not found
Parameters
int | string$contentId
int$versionNoVersion number to load
Returns

Implements eZ\Publish\SPI\Persistence\Content\Handler.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\Handler\deleteVersion(), and eZ\Publish\Core\Persistence\Legacy\Content\Handler\publish().

eZ\Publish\Core\Persistence\Legacy\Content\Handler::publish (   $contentId,
  $versionNo,
MetadataUpdateStruct  $metaDataUpdateStruct 
)

Performs the publishing operations required to set the version identified by $updateStruct->versionNo and $updateStruct->id as the published one.

The publish procedure will:

  • Create location nodes based on the node assignments
  • Update the content object using the provided metadata update struct
  • Update the node assignments
  • Update location nodes of the content with the new published version
  • Set content and version status to published
Parameters
int$contentId
int$versionNo
\eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct$metaDataUpdateStruct
Returns
The published Content

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::removeRawContent (   $contentId)

Deletes raw content data.

Parameters
int$contentId

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\Handler\deleteContent().

eZ\Publish\Core\Persistence\Legacy\Content\Handler::removeRelation (   $relationId,
  $type 
)

Removes a relation by relation Id.

Todo:
Should the existence verifications happen here or is this supposed to be handled at a higher level?
Parameters
mixed$relationId
int$type{
See Also
::COMMON, ::EMBED, ::LINK, ::FIELD}
Returns
void

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::setStatus (   $contentId,
  $status,
  $version 
)

Sets the status of object identified by $contentId and $version to $status.

The $status can be one of VersionInfo::STATUS_DRAFT, VersionInfo::STATUS_PUBLISHED, VersionInfo::STATUS_ARCHIVED When status is set to VersionInfo::STATUS_PUBLISHED content status is updated to ContentInfo::STATUS_PUBLISHED

Parameters
int$contentId
int$status
int$version
Returns
boolean

Implements eZ\Publish\SPI\Persistence\Content\Handler.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\Handler\publish().

eZ\Publish\Core\Persistence\Legacy\Content\Handler::updateContent (   $contentId,
  $versionNo,
UpdateStruct  $updateStruct 
)

Updates a content version, identified by $contentId and $versionNo.

Parameters
int$contentId
int$versionNo
\eZ\Publish\SPI\Persistence\Content\UpdateStruct$updateStruct
Returns
eZ\Publish\Core\Persistence\Legacy\Content\Handler::updateMetadata (   $contentId,
MetadataUpdateStruct  $content 
)

Updates a content object meta data, identified by $contentId.

Parameters
int$contentId
\eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct$content
Returns

Implements eZ\Publish\SPI\Persistence\Content\Handler.

eZ\Publish\Core\Persistence\Legacy\Content\Handler::updatePathIdentificationString (   $contentId,
MetadataUpdateStruct  $content 
)
protected

Updates path identification string for locations of given $contentId if main language is set in update struct.

This is specific to the Legacy storage engine, as path identification string is deprecated.

Parameters
int$contentId
\eZ\Publish\SPI\Persistence\Content\MetadataUpdateStruct$content
Returns
void

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\Handler\updateMetadata().

Member Data Documentation

eZ\Publish\Core\Persistence\Legacy\Content\Handler::$contentGateway
protected
eZ\Publish\Core\Persistence\Legacy\Content\Handler::$fieldHandler
protected
eZ\Publish\Core\Persistence\Legacy\Content\Handler::$locationGateway
protected
eZ\Publish\Core\Persistence\Legacy\Content\Handler::$locationHandler
eZ\Publish\Core\Persistence\Legacy\Content\Handler::$mapper
protected
eZ\Publish\Core\Persistence\Legacy\Content\Handler::$slugConverter
protected
eZ\Publish\Core\Persistence\Legacy\Content\Handler::$urlAliasGateway
protected

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