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

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

RelationProcessor is an internal service used for handling field relations upon Content creation or update. More...

## Public Member Functions
| __construct (Handler $handler)
| Setups service with reference to repository object that created it & corresponding handler. More...
| appendFieldRelations (array &$relations, array &$locationIdToContentIdMapping, SPIFieldType $fieldType, BaseValue $fieldValue, $fieldDefinitionId)
| Appends destination Content ids of given $fieldValue to the $relation array. More...
| processFieldRelations (array $inputRelations, $sourceContentId, $sourceContentVersionNo, ContentType $contentType, array $existingRelations=[])
| Persists relation data for a content version. More...

## Protected Attributes
| $persistenceHandler

## Detailed Description

RelationProcessor is an internal service used for handling field relations upon Content creation or update.

Meant for internal use by Repository.

Definition at line 24 of file Repository/Helper/RelationProcessor.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Repository\Helper\RelationProcessor::__construct | ( | Handler | $handler | ) |

Setups service with reference to repository object that created it & corresponding handler.

Parameters

  \eZ\Publish\SPI\Persistence\Handler | $handler |

Definition at line 36 of file Repository/Helper/RelationProcessor.php.

## Member Function Documentation

## ◆ appendFieldRelations()

eZ\Publish\Core\Repository\Helper\RelationProcessor::appendFieldRelations | ( | array & | $relations,
|  | array & | $locationIdToContentIdMapping,
|  | SPIFieldType | $fieldType,
|  | BaseValue | $fieldValue,
|  |  | $fieldDefinitionId
| ) |  |

Appends destination Content ids of given $fieldValue to the $relation array.

If $fieldValue contains Location ids, the will be converted to the Content id that Location encapsulates.

Parameters

  array | $relations |
  array | $locationIdToContentIdMapping | An array with Location Ids as keys and corresponding Content Id as values
  \eZ\Publish\SPI\FieldType\FieldType | $fieldType |
  \eZ\Publish\Core\FieldType\Value | $fieldValue | Accepted field value.
  string | $fieldDefinitionId |

Definition at line 53 of file Repository/Helper/RelationProcessor.php.

References eZ\Publish\API\Repository\Values\Content\Relation\ASSET, eZ\Publish\API\Repository\Values\Content\Relation\EMBED, eZ\Publish\API\Repository\Values\Content\Relation\FIELD, and eZ\Publish\API\Repository\Values\Content\Relation\LINK.

## ◆ processFieldRelations()

eZ\Publish\Core\Repository\Helper\RelationProcessor::processFieldRelations | ( | array | $inputRelations,
|  |  | $sourceContentId,
|  |  | $sourceContentVersionNo,
|  | ContentType | $contentType,
|  | array | $existingRelations = `[]`
| ) |  |

Persists relation data for a content version.

This method creates new relations and deletes removed relations.

Parameters

  array | $inputRelations |
  mixed | $sourceContentId |
  mixed | $sourceContentVersionNo |
  \eZ\Publish\API\Repository\Values\ContentType\ContentType | $contentType |
  \eZ\Publish\API\Repository\Values\Content\Relation[] | $existingRelations | An array of existing relations for Content version (empty when creating new content)

Definition at line 109 of file Repository/Helper/RelationProcessor.php.

References eZ\Publish\API\Repository\Values\Content\Relation\ASSET, eZ\Publish\API\Repository\Values\Content\Relation\EMBED, eZ\Publish\API\Repository\Values\Content\Relation\FIELD, eZ\Publish\API\Repository\Values\ContentType\ContentType\getFieldDefinition(), and eZ\Publish\API\Repository\Values\Content\Relation\LINK.

## Member Data Documentation

## ◆ $persistenceHandler

eZ\Publish\Core\Repository\Helper\RelationProcessor::$persistenceHandler
| protected

Definition at line 29 of file Repository/Helper/RelationProcessor.php.

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

- Repository/Helper/RelationProcessor.php

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