PHP Class eZ\Publish\Core\Repository\Helper\DomainMapper

Show file Open project: ezsystems/ezpublish-kernel Class Usage Examples

Protected Properties

Property Type Description
$contentHandler eZ\Publish\SPI\Persistence\Content\Handler
$contentLanguageHandler eZ\Publish\SPI\Persistence\Content\Language\Handler
$contentTypeHandler eZ\Publish\SPI\Persistence\Content\Type\Handler
$fieldTypeRegistry FieldTypeRegistry
$locationHandler eZ\Publish\SPI\Persistence\Content\Location\Handler

Public Methods

Method Description
__construct ( eZ\Publish\SPI\Persistence\Content\Handler $contentHandler, eZ\Publish\SPI\Persistence\Content\Location\Handler $locationHandler, eZ\Publish\SPI\Persistence\Content\Type\Handler $contentTypeHandler, eZ\Publish\SPI\Persistence\Content\Language\Handler $contentLanguageHandler, FieldTypeRegistry $fieldTypeRegistry ) Setups service with reference to repository.
buildContentDomainObject ( eZ\Publish\SPI\Persistence\Content $spiContent, eZ\Publish\API\Repository\Values\ContentType\ContentType | eZ\Publish\SPI\Persistence\Content\Type $contentType = null, array $fieldLanguages = null, string | null $fieldAlwaysAvailableLanguage = null ) : Content Builds a Content domain object from value object returned from persistence.
buildContentInfoDomainObject ( eZ\Publish\SPI\Persistence\Content\ContentInfo $spiContentInfo ) : eZ\Publish\API\Repository\Values\Content\ContentInfo Builds a ContentInfo domain object from value object returned from persistence.
buildDomainFields ( array $spiFields, eZ\Publish\API\Repository\Values\ContentType\ContentType | eZ\Publish\SPI\Persistence\Content\Type $contentType, array $languages = null, string | null $alwaysAvailableLanguage = null ) : array Returns an array of domain fields created from given array of SPI fields.
buildLocationDomainObject ( eZ\Publish\SPI\Persistence\Content\Location $spiLocation ) : eZ\Publish\API\Repository\Values\Content\Location Builds domain location object from provided persistence location.
buildRelationDomainObject ( eZ\Publish\SPI\Persistence\Content\Relation $spiRelation, eZ\Publish\API\Repository\Values\Content\ContentInfo $sourceContentInfo, eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContentInfo ) : eZ\Publish\API\Repository\Values\Content\Relation Builds API Relation object from provided SPI Relation object.
buildSPILocationCreateStruct ( eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $locationCreateStruct, eZ\Publish\API\Repository\Values\Content\Location $parentLocation, mixed $mainLocation, mixed $contentId, mixed $contentVersionNo ) : eZ\Publish\SPI\Persistence\Content\Location\CreateStruct Creates an array of SPI location create structs from given array of API location create structs.
buildVersionInfoDomainObject ( eZ\Publish\SPI\Persistence\Content\VersionInfo $spiVersionInfo ) : VersionInfo Builds a VersionInfo domain object from value object returned from persistence.
getDateTime ( integer $timestamp ) : DateTime Returns \DateTime object from given $timestamp in environment timezone.
getUniqueHash ( object $object ) : string Creates unique hash string for given $object.
isValidLocationSortField ( mixed $sortField ) : boolean Checks if given $sortField value is one of the defined sort field constants.
isValidLocationSortOrder ( mixed $sortOrder ) : boolean Checks if given $sortOrder value is one of the defined sort order constants.
validateTranslatedList ( mixed $list, string $argumentName ) Validates given translated list $list, which should be an array of strings with language codes as keys.

Method Details

__construct() public method

Setups service with reference to repository.
public __construct ( eZ\Publish\SPI\Persistence\Content\Handler $contentHandler, eZ\Publish\SPI\Persistence\Content\Location\Handler $locationHandler, eZ\Publish\SPI\Persistence\Content\Type\Handler $contentTypeHandler, eZ\Publish\SPI\Persistence\Content\Language\Handler $contentLanguageHandler, FieldTypeRegistry $fieldTypeRegistry )
$contentHandler eZ\Publish\SPI\Persistence\Content\Handler
$locationHandler eZ\Publish\SPI\Persistence\Content\Location\Handler
$contentTypeHandler eZ\Publish\SPI\Persistence\Content\Type\Handler
$contentLanguageHandler eZ\Publish\SPI\Persistence\Content\Language\Handler
$fieldTypeRegistry FieldTypeRegistry

buildContentDomainObject() public method

Builds a Content domain object from value object returned from persistence.
public buildContentDomainObject ( eZ\Publish\SPI\Persistence\Content $spiContent, eZ\Publish\API\Repository\Values\ContentType\ContentType | eZ\Publish\SPI\Persistence\Content\Type $contentType = null, array $fieldLanguages = null, string | null $fieldAlwaysAvailableLanguage = null ) : Content
$spiContent eZ\Publish\SPI\Persistence\Content
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType | eZ\Publish\SPI\Persistence\Content\Type
$fieldLanguages array Language codes to filter fields on
$fieldAlwaysAvailableLanguage string | null Language code fallback if a given field is not found in $fieldLanguages
return eZ\Publish\Core\Repository\Values\Content\Content

buildContentInfoDomainObject() public method

Builds a ContentInfo domain object from value object returned from persistence.
public buildContentInfoDomainObject ( eZ\Publish\SPI\Persistence\Content\ContentInfo $spiContentInfo ) : eZ\Publish\API\Repository\Values\Content\ContentInfo
$spiContentInfo eZ\Publish\SPI\Persistence\Content\ContentInfo
return eZ\Publish\API\Repository\Values\Content\ContentInfo

buildDomainFields() public method

Returns an array of domain fields created from given array of SPI fields.
public buildDomainFields ( array $spiFields, eZ\Publish\API\Repository\Values\ContentType\ContentType | eZ\Publish\SPI\Persistence\Content\Type $contentType, array $languages = null, string | null $alwaysAvailableLanguage = null ) : array
$spiFields array
$contentType eZ\Publish\API\Repository\Values\ContentType\ContentType | eZ\Publish\SPI\Persistence\Content\Type
$languages array Language codes to filter fields on
$alwaysAvailableLanguage string | null Language code fallback if a given field is not found in $languages
return array

buildLocationDomainObject() public method

Builds domain location object from provided persistence location.
public buildLocationDomainObject ( eZ\Publish\SPI\Persistence\Content\Location $spiLocation ) : eZ\Publish\API\Repository\Values\Content\Location
$spiLocation eZ\Publish\SPI\Persistence\Content\Location
return eZ\Publish\API\Repository\Values\Content\Location

buildRelationDomainObject() public method

Builds API Relation object from provided SPI Relation object.
public buildRelationDomainObject ( eZ\Publish\SPI\Persistence\Content\Relation $spiRelation, eZ\Publish\API\Repository\Values\Content\ContentInfo $sourceContentInfo, eZ\Publish\API\Repository\Values\Content\ContentInfo $destinationContentInfo ) : eZ\Publish\API\Repository\Values\Content\Relation
$spiRelation eZ\Publish\SPI\Persistence\Content\Relation
$sourceContentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
$destinationContentInfo eZ\Publish\API\Repository\Values\Content\ContentInfo
return eZ\Publish\API\Repository\Values\Content\Relation

buildSPILocationCreateStruct() public method

Creates an array of SPI location create structs from given array of API location create structs.
public buildSPILocationCreateStruct ( eZ\Publish\API\Repository\Values\Content\LocationCreateStruct $locationCreateStruct, eZ\Publish\API\Repository\Values\Content\Location $parentLocation, mixed $mainLocation, mixed $contentId, mixed $contentVersionNo ) : eZ\Publish\SPI\Persistence\Content\Location\CreateStruct
$locationCreateStruct eZ\Publish\API\Repository\Values\Content\LocationCreateStruct
$parentLocation eZ\Publish\API\Repository\Values\Content\Location
$mainLocation mixed
$contentId mixed
$contentVersionNo mixed
return eZ\Publish\SPI\Persistence\Content\Location\CreateStruct

buildVersionInfoDomainObject() public method

Builds a VersionInfo domain object from value object returned from persistence.
public buildVersionInfoDomainObject ( eZ\Publish\SPI\Persistence\Content\VersionInfo $spiVersionInfo ) : VersionInfo
$spiVersionInfo eZ\Publish\SPI\Persistence\Content\VersionInfo
return eZ\Publish\Core\Repository\Values\Content\VersionInfo

getDateTime() public method

This method is needed because constructing \DateTime with $timestamp will return the object in UTC timezone.
public getDateTime ( integer $timestamp ) : DateTime
$timestamp integer
return DateTime

getUniqueHash() public method

Used for remoteId.
public getUniqueHash ( object $object ) : string
$object object
return string

isValidLocationSortField() public method

Checks if given $sortField value is one of the defined sort field constants.
public isValidLocationSortField ( mixed $sortField ) : boolean
$sortField mixed
return boolean

isValidLocationSortOrder() public method

Checks if given $sortOrder value is one of the defined sort order constants.
public isValidLocationSortOrder ( mixed $sortOrder ) : boolean
$sortOrder mixed
return boolean

validateTranslatedList() public method

Validates given translated list $list, which should be an array of strings with language codes as keys.
public validateTranslatedList ( mixed $list, string $argumentName )
$list mixed
$argumentName string

Property Details

$contentHandler protected property

protected Handler,eZ\Publish\SPI\Persistence\Content $contentHandler
return eZ\Publish\SPI\Persistence\Content\Handler

$contentLanguageHandler protected property

protected Handler,eZ\Publish\SPI\Persistence\Content\Language $contentLanguageHandler
return eZ\Publish\SPI\Persistence\Content\Language\Handler

$contentTypeHandler protected property

protected Handler,eZ\Publish\SPI\Persistence\Content\Type $contentTypeHandler
return eZ\Publish\SPI\Persistence\Content\Type\Handler

$fieldTypeRegistry protected property

protected FieldTypeRegistry,eZ\Publish\Core\Repository\Helper $fieldTypeRegistry
return FieldTypeRegistry

$locationHandler protected property

protected Handler,eZ\Publish\SPI\Persistence\Content\Location $locationHandler
return eZ\Publish\SPI\Persistence\Content\Location\Handler