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

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler Class Reference

Field Handler. More...

## Public Member Functions
| __construct (Gateway $contentGateway, Mapper $mapper, StorageHandler $storageHandler, LanguageHandler $languageHandler, FieldTypeRegistry $fieldTypeRegistry)
| Creates a new Field Handler. More...
| createNewFields (Content $content, Type $contentType)
| Creates new fields in the database from $content of $contentType. More...
| createExistingFieldsInNewVersion (Content $content)
| Creates existing fields in a new version for $content. More...
| loadExternalFieldData (Content $content)
| Performs external loads for the fields in $content. More...
| updateFields (Content $content, UpdateStruct $updateStruct, Type $contentType)
| Updates the fields in for content identified by $contentId and $versionNo in the database in respect to $updateStruct. More...
| deleteFields ($contentId, VersionInfo $versionInfo)
| Deletes the fields for $contentId in $versionInfo from the database. More...
| deleteTranslationFromContentFields ($contentId, array $versions, $languageCode)
| Deletes translated fields and their external storage data for the given Content Versions. More...
| deleteTranslationFromVersionFields (VersionInfo $versionInfo, $languageCode)
| Deletes translated fields and their external storage data for the given $versionInfo. More...

## Protected Member Functions
| getEmptyField (FieldDefinition $fieldDefinition, $languageCode)
| Returns empty Field object for given field definition and language code. More...
| createNewField (Field $field, Content $content)
| Creates a new field in the database. More...
| copyFields (array $fields, Content $content)
| copyField (Field $originalField, $languageCode, Content $content)
| Copies existing field to new field for given $languageCode. More...
| updateField (Field $field, Content $content)
| Updates an existing field in the database. More...
| createExistingFieldInNewVersion (Field $field, Content $content)
| Creates an existing field in a new version, no new ID is generated. More...
| updateCopiedField (Field $field, Field $updateField, Field $originalField, Content $content)
| Updates a language copy of a non-translatable field. More...
| getFieldMap (array $fields, &$languageCodes=null)
| Returns given $fields structured in hash array with field definition ids and language codes as keys. More...

## Protected Attributes
| $contentGateway
| $languageHandler
| $mapper
| $storageHandler
| $fieldTypeRegistry
| $fieldTypes

## Detailed Description

Field Handler.

Definition at line 21 of file FieldHandler.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::__construct | ( | Gateway | $contentGateway,
|  | Mapper | $mapper,
|  | StorageHandler | $storageHandler,
|  | LanguageHandler | $languageHandler,
|  | FieldTypeRegistry | $fieldTypeRegistry
| ) |  |

Creates a new Field Handler.

Parameters

  \eZ\Publish\Core\Persistence\Legacy\Content\Gateway | $contentGateway |
  \eZ\Publish\Core\Persistence\Legacy\Content\Mapper | $mapper |
  \eZ\Publish\Core\Persistence\Legacy\Content\StorageHandler | $storageHandler |
  \eZ\Publish\SPI\Persistence\Content\Language\Handler | $languageHandler |
  \eZ\Publish\Core\Persistence\FieldTypeRegistry | $fieldTypeRegistry |

Definition at line 70 of file FieldHandler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\$contentGateway, eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\$fieldTypeRegistry, eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\$languageHandler, eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\$mapper, and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\$storageHandler.

## Member Function Documentation

## ◆ copyField()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::copyField | ( | Field | $originalField,
|  |  | $languageCode,
|  | Content | $content
| ) |  |
| protected

Copies existing field to new field for given $languageCode.

Used by self::createNewFields() and self::updateFields()

Parameters

  \eZ\Publish\SPI\Persistence\Content\Field | $originalField |
  string | $languageCode |
  \eZ\Publish\SPI\Persistence\Content | $content |

Definition at line 209 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\copyFields().

## ◆ copyFields()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::copyFields | ( | array | $fields,
|  | Content | $content
| ) |  |
| protected

Parameters

  array | $fields |
  \eZ\Publish\SPI\Persistence\Content | $content |

Definition at line 191 of file FieldHandler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\copyField().

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewFields(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

## ◆ createExistingFieldInNewVersion()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::createExistingFieldInNewVersion | ( | Field | $field,
|  | Content | $content
| ) |  |
| protected

Creates an existing field in a new version, no new ID is generated.

Used to insert a field with an existing ID but a new version number. $content is used for new version data, needed by Content gateway and external storage.

External data is being copied here as some FieldTypes require original field external data. By default copying falls back to storing, it is upon external storage implementation to override the behaviour as needed.

Parameters

  Field | $field |
  Content | $content |

Definition at line 273 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createExistingFieldsInNewVersion().

## ◆ createExistingFieldsInNewVersion()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::createExistingFieldsInNewVersion | ( | Content | $content | ) |

Creates existing fields in a new version for $content.

Parameters

  \eZ\Publish\SPI\Persistence\Content | $content |

Definition at line 151 of file FieldHandler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createExistingFieldInNewVersion().

## ◆ createNewField()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::createNewField | ( | Field | $field,
|  | Content | $content
| ) |  |
| protected

Creates a new field in the database.

Used by self::createNewFields() and self::updateFields()

Parameters

  \eZ\Publish\SPI\Persistence\Content\Field | $field |
  \eZ\Publish\SPI\Persistence\Content | $content |

Definition at line 166 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewFields(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

## ◆ createNewFields()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::createNewFields | ( | Content | $content,
|  | Type | $contentType
| ) |  |

Creates new fields in the database from $content of $contentType.

Parameters

  \eZ\Publish\SPI\Persistence\Content | $content |
  \eZ\Publish\SPI\Persistence\Content\Type | $contentType |

Definition at line 90 of file FieldHandler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\copyFields(), eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewField(), eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\getEmptyField(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\getFieldMap().

## ◆ deleteFields()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::deleteFields | ( |  | $contentId,
|  | VersionInfo | $versionInfo
| ) |  |

Deletes the fields for $contentId in $versionInfo from the database.

Parameters

  int | $contentId |
  \eZ\Publish\SPI\Persistence\Content\VersionInfo | $versionInfo |

Definition at line 437 of file FieldHandler.php.

## ◆ deleteTranslationFromContentFields()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::deleteTranslationFromContentFields | ( |  | $contentId,
|  | array | $versions,
|  |  | $languageCode
| ) |  |

Deletes translated fields and their external storage data for the given Content Versions.

Parameters

  int | $contentId |
  \eZ\Publish\SPI\Persistence\Content\VersionInfo[] | $versions |
  string | $languageCode |

Definition at line 452 of file FieldHandler.php.

## ◆ deleteTranslationFromVersionFields()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::deleteTranslationFromVersionFields | ( | VersionInfo | $versionInfo,
|  |  | $languageCode
| ) |  |

Deletes translated fields and their external storage data for the given $versionInfo.

Parameters

  \eZ\Publish\SPI\Persistence\Content\VersionInfo | $versionInfo |
  string | $languageCode |

Definition at line 476 of file FieldHandler.php.

## ◆ getEmptyField()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::getEmptyField | ( | FieldDefinition | $fieldDefinition,
|  |  | $languageCode
| ) |  |
| protected

Returns empty Field object for given field definition and language code.

Uses FieldType to create empty field value.

Parameters

  \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition | $fieldDefinition |
  string | $languageCode |

Returns
  \eZ\Publish\SPI\Persistence\Content\Field

Definition at line 132 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewFields(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

## ◆ getFieldMap()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::getFieldMap | ( | array | $fields,
|  | & | $languageCodes = `null`
| ) |  |
| protected

Returns given $fields structured in hash array with field definition ids and language codes as keys.

Parameters

  \eZ\Publish\SPI\Persistence\Content\Field[] | $fields |
  array | $languageCodes |

Returns
  \eZ\Publish\SPI\Persistence\Content\Field[][]

Definition at line 418 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewFields(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

## ◆ loadExternalFieldData()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::loadExternalFieldData | ( | Content | $content | ) |

Performs external loads for the fields in $content.

Parameters

  Content | $content |

Definition at line 300 of file FieldHandler.php.

## ◆ updateCopiedField()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::updateCopiedField | ( | Field | $field,
|  | Field | $updateField,
|  | Field | $originalField,
|  | Content | $content
| ) |  |
| protected

Updates a language copy of a non-translatable field.

External data is being copied here as some FieldTypes require original field external data. By default copying falls back to storing, it is upon external storage implementation to override the behaviour as needed.

Parameters

  \eZ\Publish\SPI\Persistence\Content\Field | $field |
  \eZ\Publish\SPI\Persistence\Content\Field | $updateField |
  \eZ\Publish\SPI\Persistence\Content\Field | $originalField |
  \eZ\Publish\SPI\Persistence\Content | $content |

Definition at line 389 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

## ◆ updateField()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::updateField | ( | Field | $field,
|  | Content | $content
| ) |  |
| protected

Updates an existing field in the database.

Used by self::createNewFields() and self::updateFields()

Parameters

  \eZ\Publish\SPI\Persistence\Content\Field | $field |
  \eZ\Publish\SPI\Persistence\Content | $content |

Definition at line 242 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateFields().

## ◆ updateFields()

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::updateFields | ( | Content | $content,
|  | UpdateStruct | $updateStruct,
|  | Type | $contentType
| ) |  |

Updates the fields in for content identified by $contentId and $versionNo in the database in respect to $updateStruct.

Parameters

  \eZ\Publish\SPI\Persistence\Content | $content |
  \eZ\Publish\SPI\Persistence\Content\UpdateStruct | $updateStruct |
  \eZ\Publish\SPI\Persistence\Content\Type | $contentType |

Definition at line 314 of file FieldHandler.php.

References eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\copyFields(), eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\createNewField(), eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\getEmptyField(), eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\getFieldMap(), eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateCopiedField(), and eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\updateField().

## Member Data Documentation

## ◆ $contentGateway

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$contentGateway
| protected

Definition at line 28 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\__construct().

## ◆ $fieldTypeRegistry

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$fieldTypeRegistry
| protected

Definition at line 52 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\__construct().

## ◆ $fieldTypes

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$fieldTypes
| protected

Definition at line 59 of file FieldHandler.php.

## ◆ $languageHandler

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$languageHandler
| protected

Definition at line 31 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\__construct().

## ◆ $mapper

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$mapper
| protected

Definition at line 38 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\__construct().

## ◆ $storageHandler

eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler::$storageHandler
| protected

Definition at line 45 of file FieldHandler.php.

Referenced by eZ\Publish\Core\Persistence\Legacy\Content\FieldHandler\__construct().

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

- FieldHandler.php

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