Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Public Member Functions | Public Attributes | Protected Attributes | Private Member Functions | List of all members
eZ\Publish\Core\Repository\Helper\DomainMapper Class Reference

DomainMapper is an internal service. More...

## Public Member Functions
| __construct (ContentHandler $contentHandler, LocationHandler $locationHandler, TypeHandler $contentTypeHandler, ContentTypeDomainMapper $contentTypeDomainMapper, LanguageHandler $contentLanguageHandler, FieldTypeRegistry $fieldTypeRegistry)
| Setups service with reference to repository. More...
| buildContentDomainObject (SPIContent $spiContent, ContentType $contentType, array $prioritizedLanguages=[], string $fieldAlwaysAvailableLanguage=null)
| Builds a Content domain object from value object. More...
| buildContentDomainObjectFromPersistence (SPIContent $spiContent, SPIContentType $spiContentType, array $prioritizedLanguages=[], ?string $fieldAlwaysAvailableLanguage=null)
| Builds a Content domain object from value object returned from persistence. More...
| buildContentProxy (SPIContent\ContentInfo $info, array $prioritizedLanguages=[], bool $useAlwaysAvailable=true)
| Builds a Content proxy object (lazy loaded, loads as soon as used). More...
| buildContentProxyList (array $infoList, array $prioritizedLanguages=[], bool $useAlwaysAvailable=true)
| Builds a list of Content proxy objects (lazy loaded, loads all as soon as one of them loads). More...
| buildDomainFields (array $spiFields, $contentType, array $prioritizedLanguages=[], string $alwaysAvailableLanguage=null)
| Returns an array of domain fields created from given array of SPI fields. More...
| buildVersionInfoDomainObject (SPIVersionInfo $spiVersionInfo, array $prioritizedLanguages=[])
| Builds a VersionInfo domain object from value object returned from persistence. More...
| buildContentInfoDomainObject (SPIContentInfo $spiContentInfo)
| Builds a ContentInfo domain object from value object returned from persistence. More...
| buildRelationDomainObject (SPIRelation $spiRelation, ContentInfo $sourceContentInfo, ContentInfo $destinationContentInfo)
| Builds API Relation object from provided SPI Relation object. More...
| buildLocationDomainObject (SPILocation $spiLocation, SPIContentInfo $contentInfo=null)
| buildLocation (SPILocation $spiLocation, array $prioritizedLanguages=[], bool $useAlwaysAvailable=true)
| buildLocationWithContent (SPILocation $spiLocation, ?APIContent $content, ?SPIContentInfo $spiContentInfo=null)
| buildLocationDomainObjectsOnSearchResult (SearchResult $result, array $languageFilter)
| Build API Location and corresponding ContentInfo domain objects and apply to LocationSearchResult. More...
| buildSPILocationCreateStruct ( $locationCreateStruct, APILocation $parentLocation, $mainLocation, $contentId, $contentVersionNo, bool $isContentHidden)
| Creates an array of SPI location create structs from given array of API location create structs. More...
| isValidLocationSortField ($sortField)
| Checks if given $sortField value is one of the defined sort field constants. More...
| isValidLocationSortOrder ($sortOrder)
| Checks if given $sortOrder value is one of the defined sort order constants. More...
| isValidLocationPriority ($priority)
| Checks if given $priority is valid. More...
| validateTranslatedList ($list, $argumentName)
| Validates given translated list $list, which should be an array of strings with language codes as keys. More...
| getDateTime ($timestamp)
| Returns \DateTime object from given $timestamp in environment timezone. More...
| getUniqueHash ($object)
| Creates unique hash string for given $object. More...

## Public Attributes
const | MAX_LOCATION_PRIORITY = 2147483647
const | MIN_LOCATION_PRIORITY = -2147483648

## Protected Attributes
| $contentHandler
| $locationHandler
| $contentTypeHandler
| $contentTypeDomainMapper
| $contentLanguageHandler
| $fieldTypeRegistry

## Private Member Functions
| buildRootLocation (SPILocation $spiLocation)
| Builds API Location object for tree root. More...
| mapLocation (SPILocation $spiLocation, ContentInfo $contentInfo, APIContent $content)
| isRootLocation (SPILocation $spiLocation)
| Returns true if given location is a tree root. More...

## Detailed Description

DomainMapper is an internal service.

Meant for internal use by Repository.

Definition at line 43 of file DomainMapper.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Repository\Helper\DomainMapper::__construct | ( | ContentHandler | $contentHandler,
|  | LocationHandler | $locationHandler,
|  | TypeHandler | $contentTypeHandler,
|  | ContentTypeDomainMapper | $contentTypeDomainMapper,
|  | LanguageHandler | $contentLanguageHandler,
|  | FieldTypeRegistry | $fieldTypeRegistry
| ) |  |

Setups service with reference to repository.

Parameters

  \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\Core\Repository\Helper\ContentTypeDomainMapper | $contentTypeDomainMapper |
  \eZ\Publish\SPI\Persistence\Content\Language\Handler | $contentLanguageHandler |
  \eZ\Publish\Core\Repository\Helper\FieldTypeRegistry | $fieldTypeRegistry |

Definition at line 76 of file DomainMapper.php.

References eZ\Publish\Core\Repository\Helper\DomainMapper\$contentHandler, eZ\Publish\Core\Repository\Helper\DomainMapper\$contentLanguageHandler, eZ\Publish\Core\Repository\Helper\DomainMapper\$contentTypeDomainMapper, eZ\Publish\Core\Repository\Helper\DomainMapper\$contentTypeHandler, eZ\Publish\Core\Repository\Helper\DomainMapper\$fieldTypeRegistry, and eZ\Publish\Core\Repository\Helper\DomainMapper\$locationHandler.

## Member Function Documentation

## ◆ buildContentDomainObject()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildContentDomainObject | ( | SPIContent | $spiContent,
|  | ContentType | $contentType,
|  | array | $prioritizedLanguages = `[]`,
|  | string | $fieldAlwaysAvailableLanguage = `null`
| ) |  |

Builds a Content domain object from value object.

Parameters

  \eZ\Publish\SPI\Persistence\Content | $spiContent |
  \eZ\Publish\API\Repository\Values\ContentType\ContentType | $contentType |
  array | $prioritizedLanguages | Prioritized language codes to filter fields on
  string | null | $fieldAlwaysAvailableLanguage | Language code fallback if a given field is not found in $prioritizedLanguages

Returns
  \eZ\Publish\Core\Repository\Values\Content\Content

Definition at line 102 of file DomainMapper.php.

References eZ\Publish\Core\Repository\Helper\DomainMapper\buildDomainFields().

## ◆ buildContentDomainObjectFromPersistence()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildContentDomainObjectFromPersistence | ( | SPIContent | $spiContent,
|  | SPIContentType | $spiContentType,
|  | array | $prioritizedLanguages = `[]`,
|  | ?string | $fieldAlwaysAvailableLanguage = `null`
| ) |  |

Builds a Content domain object from value object returned from persistence.

Parameters

  \eZ\Publish\SPI\Persistence\Content | $spiContent |
  \eZ\Publish\SPI\Persistence\Content\Type | $spiContentType |
  string[] | $prioritizedLanguages | Prioritized language codes to filter fields on
  string | null | $fieldAlwaysAvailableLanguage | Language code fallback if a given field is not found in $prioritizedLanguages

Returns
  \eZ\Publish\Core\Repository\Values\Content\Content

Definition at line 139 of file DomainMapper.php.

## ◆ buildContentInfoDomainObject()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildContentInfoDomainObject | ( | SPIContentInfo | $spiContentInfo | ) |

Builds a ContentInfo domain object from value object returned from persistence.

Parameters

  \eZ\Publish\SPI\Persistence\Content\ContentInfo | $spiContentInfo |

Returns
  \eZ\Publish\API\Repository\Values\Content\ContentInfo

Definition at line 373 of file DomainMapper.php.

## ◆ buildContentProxy()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildContentProxy | ( | SPIContent\ContentInfo | $info,
|  | array | $prioritizedLanguages = `[]`,
|  | bool | $useAlwaysAvailable = `true`
| ) |  |

Builds a Content proxy object (lazy loaded, loads as soon as used).

Definition at line 153 of file DomainMapper.php.

## ◆ buildContentProxyList()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildContentProxyList | ( | array | $infoList,
|  | array | $prioritizedLanguages = `[]`,
|  | bool | $useAlwaysAvailable = `true`
| ) |  |

Builds a list of Content proxy objects (lazy loaded, loads all as soon as one of them loads).

Parameters

  \eZ\Publish\SPI\Persistence\Content\ContentInfo[] | $infoList |
  string[] | $prioritizedLanguages |
  bool | $useAlwaysAvailable |

Returns
  \eZ\Publish\API\Repository\Values\Content\Content[<int>]

Definition at line 172 of file DomainMapper.php.

## ◆ buildDomainFields()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildDomainFields | ( | array | $spiFields,
|  |  | $contentType,
|  | array | $prioritizedLanguages = `[]`,
|  | string | $alwaysAvailableLanguage = `null`
| ) |  |

Returns an array of domain fields created from given array of SPI fields.

Exceptions

  InvalidArgumentType | On invalid $contentType

Parameters

  \eZ\Publish\SPI\Persistence\Content\Field[] | $spiFields |
  \eZ\Publish\API\Repository\Values\ContentType\ContentType | \eZ\Publish\SPI\Persistence\Content\Type | $contentType |
  array | $prioritizedLanguages | A language priority, filters returned fields and is used as prioritized language code on returned value object. If not given all languages are returned.
  string | null | $alwaysAvailableLanguage | Language code fallback if a given field is not found in $prioritizedLanguages

Returns
  array

Definition at line 249 of file DomainMapper.php.

Referenced by eZ\Publish\Core\Repository\Helper\DomainMapper\buildContentDomainObject().

## ◆ buildLocation()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildLocation | ( | SPILocation | $spiLocation,
|  | array | $prioritizedLanguages = `[]`,
|  | bool | $useAlwaysAvailable = `true`
| ) |  |

Definition at line 471 of file DomainMapper.php.

## ◆ buildLocationDomainObject()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildLocationDomainObject | ( | SPILocation | $spiLocation,
|  | SPIContentInfo | $contentInfo = `null`
| ) |  |

Deprecated:
  Since 7.2, use buildLocationWithContent(), buildLocation() or (private) mapLocation() instead.

Definition at line 456 of file DomainMapper.php.

## ◆ buildLocationDomainObjectsOnSearchResult()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildLocationDomainObjectsOnSearchResult | ( | SearchResult | $result,
|  | array | $languageFilter
| ) |  |

Build API Location and corresponding ContentInfo domain objects and apply to LocationSearchResult.

This is done in order to be able to: Load ContentInfo objects in bulk, generate proxy objects for Content that will loaded in bulk on-demand (on use).

Parameters

  \eZ\Publish\API\Repository\Values\Content\Search\SearchResult | $result | SPI search result with SPI Location items as hits
  array | $languageFilter |

Returns
  \eZ\Publish\SPI\Persistence\Content\Location[] Locations we did not find content info for is returned.

Definition at line 642 of file DomainMapper.php.

## ◆ buildLocationWithContent()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildLocationWithContent | ( | SPILocation | $spiLocation,
|  | ?APIContent | $content,
|  | ?SPIContentInfo | $spiContentInfo = `null`
| ) |  |

Parameters

  \eZ\Publish\SPI\Persistence\Content\Location | $spiLocation |
  \eZ\Publish\API\Repository\Values\Content\Content | null | $content |
  \eZ\Publish\SPI\Persistence\Content\ContentInfo | null | $spiContentInfo |

Returns
  \eZ\Publish\API\Repository\Values\Content\Location

Exceptions

Definition at line 498 of file DomainMapper.php.

## ◆ buildRelationDomainObject()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildRelationDomainObject | ( | SPIRelation | $spiRelation,
|  | ContentInfo | $sourceContentInfo,
|  | ContentInfo | $destinationContentInfo
| ) |  |

Builds API Relation object from provided SPI Relation object.

Parameters

  \eZ\Publish\SPI\Persistence\Content\Relation | $spiRelation |
  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $sourceContentInfo |
  \eZ\Publish\API\Repository\Values\Content\ContentInfo | $destinationContentInfo |

Returns
  \eZ\Publish\API\Repository\Values\Content\Relation

Definition at line 424 of file DomainMapper.php.

## ◆ buildRootLocation()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildRootLocation | ( | SPILocation | $spiLocation | ) |
| private

Builds API Location object for tree root.

Parameters

  \eZ\Publish\SPI\Persistence\Content\Location | $spiLocation |

Returns
  \eZ\Publish\API\Repository\Values\Content\Location

Definition at line 527 of file DomainMapper.php.

## ◆ buildSPILocationCreateStruct()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildSPILocationCreateStruct | ( |  | $locationCreateStruct,
|  | APILocation | $parentLocation,
|  |  | $mainLocation,
|  |  | $contentId,
|  |  | $contentVersionNo,
|  | bool | $isContentHidden
| ) |  |

Creates an array of SPI location create structs from given array of API location create structs.

Exceptions

Definition at line 690 of file DomainMapper.php.

## ◆ buildVersionInfoDomainObject()

eZ\Publish\Core\Repository\Helper\DomainMapper::buildVersionInfoDomainObject | ( | SPIVersionInfo | $spiVersionInfo,
|  | array | $prioritizedLanguages = `[]`
| ) |  |

Builds a VersionInfo domain object from value object returned from persistence.

Parameters

  \eZ\Publish\SPI\Persistence\Content\VersionInfo | $spiVersionInfo |
  array | $prioritizedLanguages |

Returns
  \eZ\Publish\Core\Repository\Values\Content\VersionInfo

Definition at line 323 of file DomainMapper.php.

## ◆ getDateTime()

eZ\Publish\Core\Repository\Helper\DomainMapper::getDateTime | ( |  | $timestamp | ) |

Returns \DateTime object from given $timestamp in environment timezone.

This method is needed because constructing \DateTime with $timestamp will return the object in UTC timezone.

Parameters

  int | $timestamp |

Returns
  \DateTime

Definition at line 850 of file DomainMapper.php.

## ◆ getUniqueHash()

eZ\Publish\Core\Repository\Helper\DomainMapper::getUniqueHash | ( |  | $object | ) |

Creates unique hash string for given $object.

Used for remoteId.

Parameters

  object | $object |

Returns
  string

Definition at line 867 of file DomainMapper.php.

## ◆ isRootLocation()

eZ\Publish\Core\Repository\Helper\DomainMapper::isRootLocation | ( | SPILocation | $spiLocation | ) |
| private

Returns true if given location is a tree root.

Parameters

  \eZ\Publish\SPI\Persistence\Content\Location | $spiLocation |

Returns
  bool

Definition at line 879 of file DomainMapper.php.

## ◆ isValidLocationPriority()

eZ\Publish\Core\Repository\Helper\DomainMapper::isValidLocationPriority | ( |  | $priority | ) |

Checks if given $priority is valid.

Parameters

  int | $priority |

Returns
  bool

Definition at line 808 of file DomainMapper.php.

## ◆ isValidLocationSortField()

eZ\Publish\Core\Repository\Helper\DomainMapper::isValidLocationSortField | ( |  | $sortField | ) |

Checks if given $sortField value is one of the defined sort field constants.

Parameters

  mixed | $sortField |

Returns
  bool

Definition at line 762 of file DomainMapper.php.

## ◆ isValidLocationSortOrder()

eZ\Publish\Core\Repository\Helper\DomainMapper::isValidLocationSortOrder | ( |  | $sortOrder | ) |

Checks if given $sortOrder value is one of the defined sort order constants.

Parameters

  mixed | $sortOrder |

Returns
  bool

Definition at line 790 of file DomainMapper.php.

## ◆ mapLocation()

eZ\Publish\Core\Repository\Helper\DomainMapper::mapLocation | ( | SPILocation | $spiLocation,
|  | ContentInfo | $contentInfo,
|  | APIContent | $content
| ) |  |
| private

Definition at line 554 of file DomainMapper.php.

## ◆ validateTranslatedList()

eZ\Publish\Core\Repository\Helper\DomainMapper::validateTranslatedList | ( |  | $list,
|  |  | $argumentName
| ) |  |

Validates given translated list $list, which should be an array of strings with language codes as keys.

Exceptions

Definition at line 825 of file DomainMapper.php.

## Member Data Documentation

## ◆ $contentHandler

eZ\Publish\Core\Repository\Helper\DomainMapper::$contentHandler
| protected

Definition at line 49 of file DomainMapper.php.

Referenced by eZ\Publish\Core\Repository\Helper\DomainMapper\__construct().

## ◆ $contentLanguageHandler

eZ\Publish\Core\Repository\Helper\DomainMapper::$contentLanguageHandler
| protected

Definition at line 61 of file DomainMapper.php.

Referenced by eZ\Publish\Core\Repository\Helper\DomainMapper\__construct().

## ◆ $contentTypeDomainMapper

eZ\Publish\Core\Repository\Helper\DomainMapper::$contentTypeDomainMapper
| protected

Definition at line 58 of file DomainMapper.php.

Referenced by eZ\Publish\Core\Repository\Helper\DomainMapper\__construct().

## ◆ $contentTypeHandler

eZ\Publish\Core\Repository\Helper\DomainMapper::$contentTypeHandler
| protected

Definition at line 55 of file DomainMapper.php.

Referenced by eZ\Publish\Core\Repository\Helper\DomainMapper\__construct().

## ◆ $fieldTypeRegistry

eZ\Publish\Core\Repository\Helper\DomainMapper::$fieldTypeRegistry
| protected

Definition at line 64 of file DomainMapper.php.

Referenced by eZ\Publish\Core\Repository\Helper\DomainMapper\__construct().

## ◆ $locationHandler

eZ\Publish\Core\Repository\Helper\DomainMapper::$locationHandler
| protected

Definition at line 52 of file DomainMapper.php.

Referenced by eZ\Publish\Core\Repository\Helper\DomainMapper\__construct().

## ◆ MAX_LOCATION_PRIORITY

const eZ\Publish\Core\Repository\Helper\DomainMapper::MAX_LOCATION_PRIORITY = 2147483647

Definition at line 45 of file DomainMapper.php.

## ◆ MIN_LOCATION_PRIORITY

const eZ\Publish\Core\Repository\Helper\DomainMapper::MIN_LOCATION_PRIORITY = -2147483648

Definition at line 46 of file DomainMapper.php.

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

- DomainMapper.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.