Class

eZ\Publish\Core\Persistence\Legacy\Content\Gateway

abstract class Gateway

Base class for content gateways.

Methods

array getContext()

Get context definition for external storage layers.

int insertContentObject(CreateStruct $struct, mixed $currentVersionNo = 1)

Inserts a new content object.

int insertVersion(VersionInfo $versionInfo, array $fields)

Inserts a new version.

updateContent(int $contentId, MetadataUpdateStruct $struct, VersionInfo $prePublishVersionInfo = null)

Updates an existing content identified by $contentId in respect to $struct.

updateVersion(int $contentId, int $versionNo, UpdateStruct $struct)

Updates version $versionNo for content identified by $contentId, in respect to $struct.

updateAlwaysAvailableFlag(int $contentId, bool $newAlwaysAvailable)

Updates "always available" flag for content identified by $contentId, in respect to $alwaysAvailable.

bool setStatus(int $contentId, int $version, int $status)

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

int insertNewField(Content $content, Field $field, StorageFieldValue $value)

Inserts a new field.

insertExistingField(Content $content, Field $field, StorageFieldValue $value)

Inserts an existing field.

updateField(Field $field, StorageFieldValue $value)

Updates an existing field.

updateNonTranslatableField(Field $field, StorageFieldValue $value, int $contentId)

Updates an existing, non-translatable field.

array load(mixed $contentId, mixed $version, array $translations = null)

Loads data for a content object.

array loadContentInfoByRemoteId(mixed $remoteId)

Loads info for a content object identified by its remote ID.

array loadContentInfo(int $contentId)

Loads info for content identified by $contentId.

array loadVersionInfo(int $contentId, int $versionNo)

Loads version info for content identified by $contentId and $versionNo.

string[][] listVersionsForUser(int $userId, int $status = VersionInfo::STATUS_DRAFT)

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

string[][] listVersions(mixed $contentId, mixed|null $status = null, int $limit = -1)

Returns all version data for the given $contentId.

int[] listVersionNumbers(mixed $contentId)

Returns all version numbers for the given $contentId.

int getLastVersionNumber(int $contentId)

Returns last version number for content identified by $contentId.

int[] getAllLocationIds(int $contentId)

Returns all IDs for locations that refer to $contentId.

int[][] getFieldIdsByType(int $contentId, int|null $versionNo = null, string|null $languageCode = null)

Returns all field IDs of $contentId grouped by their type.

deleteRelations(int $contentId, int|null $versionNo = null)

Deletes relations to and from $contentId.

removeReverseFieldRelations(int $contentId)

Removes relations to Content with $contentId from Relation and RelationList field type fields.

deleteField(int $fieldId)

Deletes the field with the given $fieldId.

deleteFields(int $contentId, int|null $versionNo = null)

Deletes all fields of $contentId in all versions.

deleteVersions(int $contentId, int|null $versionNo = null)

Deletes all versions of $contentId.

deleteNames(int $contentId, int|null $versionNo = null)

Deletes all names of $contentId.

setName(int $contentId, int $version, string $name, string $language)

Sets the content object name.

deleteContent(int $contentId)

Deletes the actual content object referred to by $contentId.

mixed[][] loadRelations(int $contentId, int $contentVersionNo = null, int $relationType = null)

Loads data of related to/from $contentId.

mixed[][] loadReverseRelations($contentId, $relationType = null)

Loads data of related to/from $contentId.

deleteRelation(int $relationId, int $type)

Deletes the relation with the given $relationId.

int insertRelation(CreateStruct $createStruct)

Inserts a new relation database record.

int[] getContentIdsByContentTypeId(int $contentTypeId)

Returns all Content IDs for a given $contentTypeId.

array loadVersionedNameData(array[] $rows)

Load name data for set of content id's and corresponding version number.

copyRelations(int $originalContentId, int $copiedContentId, int|null $versionNo = null)

Batch method for copying all relation meta data for copied Content object.

removeTranslationFromContent(int $contentId, string $languageCode)

Remove the specified translation from all the Versions of a Content Object.

deleteTranslatedFields(string $languageCode, int $contentId, int $versionNo = null)

Delete Content fields (attributes) for the given Translation.

deleteTranslationFromVersion(int $contentId, int $versionNo, string $languageCode)

Delete the specified Translation from the given Version.

Details

at line 29
abstract public array getContext()

Get context definition for external storage layers.

Return Value

array

at line 39
abstract public int insertContentObject(CreateStruct $struct, mixed $currentVersionNo = 1)

Inserts a new content object.

Parameters

CreateStruct $struct
mixed $currentVersionNo

Return Value

int ID

at line 49
abstract public int insertVersion(VersionInfo $versionInfo, array $fields)

Inserts a new version.

Parameters

VersionInfo $versionInfo
array $fields

Return Value

int ID

at line 58
abstract public updateContent(int $contentId, MetadataUpdateStruct $struct, VersionInfo $prePublishVersionInfo = null)

Updates an existing content identified by $contentId in respect to $struct.

Parameters

int $contentId
MetadataUpdateStruct $struct
VersionInfo $prePublishVersionInfo Provided on publish

at line 71
abstract public updateVersion(int $contentId, int $versionNo, UpdateStruct $struct)

Updates version $versionNo for content identified by $contentId, in respect to $struct.

Parameters

int $contentId
int $versionNo
UpdateStruct $struct

at line 79
abstract public updateAlwaysAvailableFlag(int $contentId, bool $newAlwaysAvailable)

Updates "always available" flag for content identified by $contentId, in respect to $alwaysAvailable.

Parameters

int $contentId
bool $newAlwaysAvailable New "always available" value

at line 92
abstract public bool setStatus(int $contentId, int $version, int $status)

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

The $status can be one of STATUSDRAFT, STATUSPUBLISHED, STATUS_ARCHIVED

Parameters

int $contentId
int $version
int $status

Return Value

bool

at line 107
abstract public int insertNewField(Content $content, Field $field, StorageFieldValue $value)

Inserts a new field.

Only used when a new field is created (i.e. a new object or a field in a new language!). After that, field IDs need to stay the same, only the version number changes.

Parameters

Content $content
Field $field
StorageFieldValue $value

Return Value

int ID

at line 118
abstract public insertExistingField(Content $content, Field $field, StorageFieldValue $value)

Inserts an existing field.

Used to insert a field with an existing ID but a new version number.

Parameters

Content $content
Field $field
StorageFieldValue $value

at line 126
abstract public updateField(Field $field, StorageFieldValue $value)

Updates an existing field.

Parameters

Field $field
StorageFieldValue $value

at line 135
abstract public updateNonTranslatableField(Field $field, StorageFieldValue $value, int $contentId)

Updates an existing, non-translatable field.

Parameters

Field $field
StorageFieldValue $value
int $contentId

at line 152
abstract public array load(mixed $contentId, mixed $version, array $translations = null)

Loads data for a content object.

Returns an array with the relevant data.

Parameters

mixed $contentId
mixed $version
array $translations

Return Value

array

at line 163
abstract public array loadContentInfoByRemoteId(mixed $remoteId)

Loads info for a content object identified by its remote ID.

Returns an array with the relevant data.

Parameters

mixed $remoteId

Return Value

array

at line 177
abstract public array loadContentInfo(int $contentId)

Loads info for content identified by $contentId.

Will basically return a hash containing all field values for ezcontentobject table plus following keys: - alwaysavailable => Boolean indicating if content's language mask contains alwaysAvailable bit field - mainlanguage_code => Language code for main (initial) language. E.g. "eng-GB".

Parameters

int $contentId

Return Value

array

Exceptions

NotFoundException

at line 191
abstract public array loadVersionInfo(int $contentId, int $versionNo)

Loads version info for content identified by $contentId and $versionNo.

Will basically return a hash containing all field values from ezcontentobjectversion table plus following keys: - names => Hash of content object names. Key is the language code, value is the name. - languages => Hash of language ids. Key is the language code (e.g. "eng-GB"), value is the language numeric id without the always available bit. - initiallanguage_code => Language code for initial language in this version.

Parameters

int $contentId
int $versionNo

Return Value

array

at line 201
abstract public string[][] listVersionsForUser(int $userId, int $status = VersionInfo::STATUS_DRAFT)

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

Parameters

int $userId
int $status

Return Value

string[][]

at line 214
abstract public string[][] listVersions(mixed $contentId, mixed|null $status = null, int $limit = -1)

Returns all version data for the given $contentId.

Result is returned with oldest version first (using version id as it has index and is auto increment).

Parameters

mixed $contentId
mixed|null $status Optional argument to filter versions by status, like {see VersionInfo::STATUS_ARCHIVED}.
int $limit Limit for items returned, -1 means none.

Return Value

string[][]

at line 223
abstract public int[] listVersionNumbers(mixed $contentId)

Returns all version numbers for the given $contentId.

Parameters

mixed $contentId

Return Value

int[]

at line 232
abstract public int getLastVersionNumber(int $contentId)

Returns last version number for content identified by $contentId.

Parameters

int $contentId

Return Value

int

at line 241
abstract public int[] getAllLocationIds(int $contentId)

Returns all IDs for locations that refer to $contentId.

Parameters

int $contentId

Return Value

int[]

at line 254
abstract public int[][] getFieldIdsByType(int $contentId, int|null $versionNo = null, string|null $languageCode = null)

Returns all field IDs of $contentId grouped by their type.

If $versionNo is set only field IDs for that version are returned. If $languageCode is set, only field IDs for that language are returned.

Parameters

int $contentId
int|null $versionNo
string|null $languageCode

Return Value

int[][]

at line 263
abstract public deleteRelations(int $contentId, int|null $versionNo = null)

Deletes relations to and from $contentId.

If $versionNo is set only relations for that version are deleted.

Parameters

int $contentId
int|null $versionNo

at line 270
abstract public removeReverseFieldRelations(int $contentId)

Removes relations to Content with $contentId from Relation and RelationList field type fields.

Parameters

int $contentId

at line 277
abstract public deleteField(int $fieldId)

Deletes the field with the given $fieldId.

Parameters

int $fieldId

at line 286
abstract public deleteFields(int $contentId, int|null $versionNo = null)

Deletes all fields of $contentId in all versions.

If $versionNo is set only fields for that version are deleted.

Parameters

int $contentId
int|null $versionNo

at line 295
abstract public deleteVersions(int $contentId, int|null $versionNo = null)

Deletes all versions of $contentId.

If $versionNo is set only that version is deleted.

Parameters

int $contentId
int|null $versionNo

at line 304
abstract public deleteNames(int $contentId, int|null $versionNo = null)

Deletes all names of $contentId.

If $versionNo is set only names for that version are deleted.

Parameters

int $contentId
int|null $versionNo

at line 314
abstract public setName(int $contentId, int $version, string $name, string $language)

Sets the content object name.

Parameters

int $contentId
int $version
string $name
string $language

at line 321
abstract public deleteContent(int $contentId)

Deletes the actual content object referred to by $contentId.

Parameters

int $contentId

at line 332
abstract public mixed[][] loadRelations(int $contentId, int $contentVersionNo = null, int $relationType = null)

Loads data of related to/from $contentId.

Parameters

int $contentId
int $contentVersionNo
int $relationType

Return Value

mixed[][] Content data, array structured like {see \eZ\Publish\Core\Persistence\Legacy\Content\Gateway::load()}

at line 344
abstract public mixed[][] loadReverseRelations($contentId, $relationType = null)

Loads data of related to/from $contentId.

Parameters

$contentId
$relationType

Return Value

mixed[][] Content data, array structured like {see \eZ\Publish\Core\Persistence\Legacy\Content\Gateway::load()}

at line 355
abstract public deleteRelation(int $relationId, int $type)

Deletes the relation with the given $relationId.

Parameters

int $relationId
int $type {see \eZ\Publish\API\Repository\Values\Content\Relation::COMMON, \eZ\Publish\API\Repository\Values\Content\Relation::EMBED, \eZ\Publish\API\Repository\Values\Content\Relation::LINK, \eZ\Publish\API\Repository\Values\Content\Relation::FIELD}

at line 364
abstract public int insertRelation(CreateStruct $createStruct)

Inserts a new relation database record.

Parameters

CreateStruct $createStruct

Return Value

int ID the inserted ID

at line 373
abstract public int[] getContentIdsByContentTypeId(int $contentTypeId)

Returns all Content IDs for a given $contentTypeId.

Parameters

int $contentTypeId

Return Value

int[]

at line 382
abstract public array loadVersionedNameData(array[] $rows)

Load name data for set of content id's and corresponding version number.

Parameters

array[] $rows array of hashes with 'id' and 'version' to load names for

Return Value

array

at line 397
abstract public copyRelations(int $originalContentId, int $copiedContentId, int|null $versionNo = null)

Batch method for copying all relation meta data for copied Content object.

Is meant to be used during content copy, so assumes the following: - version number is the same - content type, and hence content type attribute is the same - relation type is the same - target relation is the same

Parameters

int $originalContentId
int $copiedContentId
int|null $versionNo If specified only copy for a given version number, otherwise all.

at line 405
abstract public removeTranslationFromContent(int $contentId, string $languageCode)

Remove the specified translation from all the Versions of a Content Object.

Parameters

int $contentId
string $languageCode language code of the translation

at line 415
abstract public deleteTranslatedFields(string $languageCode, int $contentId, int $versionNo = null)

Delete Content fields (attributes) for the given Translation.

If $versionNo is given, fields for that Version only will be deleted.

Parameters

string $languageCode
int $contentId
int $versionNo (optional) filter by versionNo

at line 424
abstract public deleteTranslationFromVersion(int $contentId, int $versionNo, string $languageCode)

Delete the specified Translation from the given Version.

Parameters

int $contentId
int $versionNo
string $languageCode