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

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
eZ\Publish\Core\FieldType\BinaryBase\Type Class Reference

Base FileType class for Binary field types (i.e. More...

Inheritance diagram for eZ\Publish\Core\FieldType\BinaryBase\Type:

## Public Member Functions
| __construct (array $validators, ?RouteAwarePathGenerator $routeAwarePathGenerator=null)
| getName (SPIValue $value)
| Returns the name of the given field value. More...
| fromHash ($hash)
| Converts an $hash to the Value defined by the field type. More...
| toHash (SPIValue $value)
| Converts a $Value to a hash. More...
| toPersistenceValue (SPIValue $value)
| Converts a $value to a persistence value. More...
| fromPersistenceValue (PersistenceValue $fieldValue)
| Converts a persistence $fieldValue to a Value. More...
| validate (FieldDefinition $fieldDefinition, SPIValue $fieldValue)
| Validates a field based on the validators in the field definition. More...
| validateValidatorConfiguration ($validatorConfiguration)
| Validates the validatorConfiguration of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct. More...
| isSearchable ()
| Returns whether the field type is searchable. More...
Public Member Functions inherited from eZ\Publish\Core\FieldType\FieldType
| setTransformationProcessor (TransformationProcessor $transformationProcessor)
| getSettingsSchema ()
| Returns a schema for the settings expected by the FieldType. More...
| getValidatorConfigurationSchema ()
| Returns a schema for the validator configuration expected by the FieldType. More...
| applyDefaultValidatorConfiguration (&$validatorConfiguration)
| Applies the default values to the given $validatorConfiguration of a FieldDefinitionCreateStruct. More...
| validateFieldSettings ($fieldSettings)
| Validates the fieldSettings of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct. More...
| applyDefaultSettings (&$fieldSettings)
| Applies the default values to the fieldSettings of a FieldDefinitionCreateStruct. More...
| isSingular ()
| Indicates if the field definition of this type can appear only once in the same ContentType. More...
| onlyEmptyInstance ()
| Indicates if the field definition of this type can be added to a ContentType with Content instances. More...
| isEmptyValue (SPIValue $value)
| Returns if the given $value is considered empty by the field type. More...
| acceptValue ($inputValue)
| Potentially builds and checks the type and structure of the $inputValue. More...
| fieldSettingsToHash ($fieldSettings)
| Converts the given $fieldSettings to a simple hash format. More...
| fieldSettingsFromHash ($fieldSettingsHash)
| Converts the given $fieldSettingsHash to field settings of the type. More...
| validatorConfigurationToHash ($validatorConfiguration)
| Converts the given $validatorConfiguration to a simple hash format. More...
| validatorConfigurationFromHash ($validatorConfigurationHash)
| Converts the given $validatorConfigurationHash to a validator configuration of the type. More...
| getRelations (SPIValue $fieldValue)
| Returns relation data extracted from value. More...
| valuesEqual (SPIValue $value1, SPIValue $value2)
Public Member Functions inherited from eZ\Publish\SPI\FieldType\FieldType
| getFieldTypeIdentifier ()
| Returns the field type identifier for this field type. More...
| getName (Value $value)
| Returns a human readable string representation from the given $value. More...
| validate (FieldDefinition $fieldDef, Value $value)
| Validates a field based on the validator configuration in the field definition. More...
| getEmptyValue ()
| Returns the empty value for this field type. More...
| isEmptyValue (Value $value)
| Returns if the given $value is considered empty by the field type. More...
| toHash (Value $value)
| Converts the given $value into a plain hash format. More...
| toPersistenceValue (Value $value)
| Converts a $value to a persistence value. More...
| fromPersistenceValue (FieldValue $fieldValue)
| Converts a persistence $value to a Value. More...
| getRelations (Value $value)
| Returns relation data extracted from value. More...
Public Member Functions inherited from eZ\Publish\SPI\FieldType\Comparable
| valuesEqual (Value $value1, Value $value2)

## Protected Member Functions
| createValue (array $inputValue)
| Creates a specific value of the derived class from $inputValue. More...
| regenerateUri (array $inputValue)
| createValueFromInput ($inputValue)
| Inspects given $inputValue and potentially converts it into a dedicated value object. More...
| checkValueStructure (BaseValue $value)
| Throws an exception if value structure is not of expected format. More...
| completeValue (BaseValue $value)
| Attempts to complete the data in $value. More...
| getSortInfo (BaseValue $value)
| BinaryBase does not support sorting, yet. More...
Protected Member Functions inherited from eZ\Publish\Core\FieldType\FieldType
| getSortInfo (Value $value)
| Returns information for FieldValue->$sortKey relevant to the field type. More...
| checkValueStructure (Value $value)
| Throws an exception if value structure is not of expected format. More...

## Protected Attributes
| $validatorConfigurationSchema
| $routeAwarePathGenerator
Protected Attributes inherited from eZ\Publish\Core\FieldType\FieldType
| $settingsSchema = []
| $validatorConfigurationSchema = []
| $transformationProcessor

## Private Attributes
| $validators

## Additional Inherited Members
Static Protected Member Functions inherited from eZ\Publish\Core\FieldType\FieldType
static | checkValueType ($value)
| Throws an exception if the given $value is not an instance of the supported value subtype. More...

## Detailed Description

Base FileType class for Binary field types (i.e.

BinaryBase & Media).

Definition at line 22 of file Core/FieldType/BinaryBase/Type.php.

## Constructor & Destructor Documentation

## ◆ __construct()

eZ\Publish\Core\FieldType\BinaryBase\Type::__construct | ( | array | $validators,
|  | ?RouteAwarePathGenerator | $routeAwarePathGenerator = `null`
| ) |  |

Parameters

  \eZ\Publish\Core\FieldType\Validator[] | $validators |

Definition at line 45 of file Core/FieldType/BinaryBase/Type.php.

References eZ\Publish\Core\FieldType\BinaryBase\Type\$routeAwarePathGenerator, and eZ\Publish\Core\FieldType\BinaryBase\Type\$validators.

## Member Function Documentation

## ◆ checkValueStructure()

eZ\Publish\Core\FieldType\BinaryBase\Type::checkValueStructure | ( | BaseValue | $value | ) |
| protected

Throws an exception if value structure is not of expected format.

Exceptions

Reimplemented in eZ\Publish\Core\FieldType\Media\Type.

Definition at line 120 of file Core/FieldType/BinaryBase/Type.php.

## ◆ completeValue()

eZ\Publish\Core\FieldType\BinaryBase\Type::completeValue | ( | BaseValue | $value | ) |
| protected

Attempts to complete the data in $value.

Parameters

  \eZ\Publish\Core\FieldType\BinaryBase\Value | \eZ\Publish\Core\FieldType\Value | $value |

Reimplemented in eZ\Publish\Core\FieldType\Media\Type.

Definition at line 163 of file Core/FieldType/BinaryBase/Type.php.

Referenced by eZ\Publish\Core\FieldType\BinaryBase\Type\createValueFromInput().

## ◆ createValue()

eZ\Publish\Core\FieldType\BinaryBase\Type::createValue | ( | array | $inputValue | ) |
| abstract protected

Creates a specific value of the derived class from $inputValue.

Parameters

  array | $inputValue |

Returns
  Value

Reimplemented in eZ\Publish\Core\FieldType\Media\Type, and eZ\Publish\Core\FieldType\BinaryFile\Type.

Referenced by eZ\Publish\Core\FieldType\BinaryBase\Type\createValueFromInput(), and eZ\Publish\Core\FieldType\BinaryBase\Type\fromHash().

## ◆ createValueFromInput()

eZ\Publish\Core\FieldType\BinaryBase\Type::createValueFromInput | ( |  | $inputValue | ) |
| protected

Inspects given $inputValue and potentially converts it into a dedicated value object.

Parameters

  string | array | \eZ\Publish\Core\FieldType\BinaryBase\Value | $inputValue |

Returns
  \eZ\Publish\Core\FieldType\BinaryBase\Value The potentially converted and structurally plausible value.

Reimplemented from eZ\Publish\Core\FieldType\FieldType.

Definition at line 96 of file Core/FieldType/BinaryBase/Type.php.

References eZ\Publish\Core\FieldType\BinaryBase\Type\completeValue(), and eZ\Publish\Core\FieldType\BinaryBase\Type\createValue().

## ◆ fromHash()

eZ\Publish\Core\FieldType\BinaryBase\Type::fromHash | ( |  | $hash | ) |

Converts an $hash to the Value defined by the field type.

Parameters

  mixed | $hash |

Returns
  \eZ\Publish\Core\FieldType\BinaryBase\Value $value

Implements eZ\Publish\SPI\FieldType\FieldType.

Definition at line 198 of file Core/FieldType/BinaryBase/Type.php.

References eZ\Publish\Core\FieldType\BinaryBase\Type\createValue(), and eZ\Publish\SPI\FieldType\FieldType\getEmptyValue().

Referenced by eZ\Publish\Core\FieldType\BinaryBase\Type\fromPersistenceValue().

## ◆ fromPersistenceValue()

eZ\Publish\Core\FieldType\BinaryBase\Type::fromPersistenceValue | ( | PersistenceValue | $fieldValue | ) |

Converts a persistence $fieldValue to a Value.

This method builds a field type value from the $data and $externalData properties.

Parameters

  \eZ\Publish\SPI\Persistence\Content\FieldValue | $fieldValue |

Returns
  \eZ\Publish\Core\FieldType\BinaryBase\Value

Reimplemented from eZ\Publish\Core\FieldType\FieldType.

Definition at line 271 of file Core/FieldType/BinaryBase/Type.php.

References eZ\Publish\Core\FieldType\BinaryBase\Type\fromHash().

## ◆ getName()

eZ\Publish\Core\FieldType\BinaryBase\Type::getName | ( | SPIValue | $value | ) |

Returns the name of the given field value.

It will be used to generate content name and url alias if current field is designated to be used in the content name/urlAlias pattern.

Parameters

  \eZ\Publish\Core\FieldType\BinaryBase\Value | $value |

Returns
  string

Definition at line 84 of file Core/FieldType/BinaryBase/Type.php.

## ◆ getSortInfo()

eZ\Publish\Core\FieldType\BinaryBase\Type::getSortInfo | ( | BaseValue | $value | ) |
| protected

BinaryBase does not support sorting, yet.

Parameters

  \eZ\Publish\Core\FieldType\BinaryBase\Value | $value |

Returns
  mixed

Definition at line 186 of file Core/FieldType/BinaryBase/Type.php.

Referenced by eZ\Publish\Core\FieldType\BinaryBase\Type\toPersistenceValue().

## ◆ isSearchable()

eZ\Publish\Core\FieldType\BinaryBase\Type::isSearchable | ( |  | ) |

Returns whether the field type is searchable.

Returns
  bool

Reimplemented from eZ\Publish\Core\FieldType\FieldType.

Reimplemented in eZ\Publish\Core\FieldType\Media\Type.

Definition at line 404 of file Core/FieldType/BinaryBase/Type.php.

## ◆ regenerateUri()

eZ\Publish\Core\FieldType\BinaryBase\Type::regenerateUri | ( | array | $inputValue | ) |
| final protected

Definition at line 60 of file Core/FieldType/BinaryBase/Type.php.

Referenced by eZ\Publish\Core\FieldType\BinaryFile\Type\createValue(), and eZ\Publish\Core\FieldType\Media\Type\createValue().

## ◆ toHash()

eZ\Publish\Core\FieldType\BinaryBase\Type::toHash | ( | SPIValue | $value | ) |

Converts a $Value to a hash.

Parameters

  \eZ\Publish\Core\FieldType\BinaryBase\Value | $value |

Returns
  mixed

Reimplemented in eZ\Publish\Core\FieldType\Media\Type, and eZ\Publish\Core\FieldType\BinaryFile\Type.

Definition at line 214 of file Core/FieldType/BinaryBase/Type.php.

Referenced by eZ\Publish\Core\FieldType\BinaryBase\Type\toPersistenceValue().

## ◆ toPersistenceValue()

eZ\Publish\Core\FieldType\BinaryBase\Type::toPersistenceValue | ( | SPIValue | $value | ) |

Converts a $value to a persistence value.

In this method the field type puts the data which is stored in the field of content in the repository into the property FieldValue::data. The format of $data is a primitive, an array (map) or an object, which is then canonically converted to e.g. json/xml structures by future storage engines without further conversions. For mapping the $data to the legacy database an appropriate Converter (implementing eZ\Publish\Core\Persistence\Legacy\FieldValue\Converter) has implemented for the field type. Note: $data should only hold data which is actually stored in the field. It must not hold data which is stored externally.

The $externalData property in the FieldValue is used for storing data externally by the FieldStorage interface method storeFieldData.

The FieldValuer::sortKey is build by the field type for using by sort operations.

See also
  \eZ\Publish\SPI\Persistence\Content\FieldValue

Parameters

  \eZ\Publish\Core\FieldType\BinaryBase\Value | $value | The value of the field type

Returns
  \eZ\Publish\SPI\Persistence\Content\FieldValue the value processed by the storage engine

Reimplemented from eZ\Publish\Core\FieldType\FieldType.

Definition at line 250 of file Core/FieldType/BinaryBase/Type.php.

References eZ\Publish\Core\FieldType\BinaryBase\Type\getSortInfo(), and eZ\Publish\Core\FieldType\BinaryBase\Type\toHash().

## ◆ validate()

eZ\Publish\Core\FieldType\BinaryBase\Type::validate | ( | FieldDefinition | $fieldDefinition,
|  | SPIValue | $fieldValue
| ) |  |

Validates a field based on the validators in the field definition.

Exceptions

Reimplemented from eZ\Publish\Core\FieldType\FieldType.

Definition at line 304 of file Core/FieldType/BinaryBase/Type.php.

References eZ\Publish\API\Repository\Values\ContentType\FieldDefinition\getValidatorConfiguration(), and eZ\Publish\Core\FieldType\FieldType\isEmptyValue().

## ◆ validateValidatorConfiguration()

eZ\Publish\Core\FieldType\BinaryBase\Type::validateValidatorConfiguration | ( |  | $validatorConfiguration | ) |

Validates the validatorConfiguration of a FieldDefinitionCreateStruct or FieldDefinitionUpdateStruct.

Parameters

  mixed | $validatorConfiguration |

Returns
  \eZ\Publish\SPI\FieldType\ValidationError[]

Reimplemented from eZ\Publish\Core\FieldType\FieldType.

Definition at line 352 of file Core/FieldType/BinaryBase/Type.php.

## Member Data Documentation

## ◆ $routeAwarePathGenerator

eZ\Publish\Core\FieldType\BinaryBase\Type::$routeAwarePathGenerator
| protected

Definition at line 40 of file Core/FieldType/BinaryBase/Type.php.

Referenced by eZ\Publish\Core\FieldType\BinaryBase\Type\__construct().

## ◆ $validatorConfigurationSchema

eZ\Publish\Core\FieldType\BinaryBase\Type::$validatorConfigurationSchema
| protected

Initial value:
= [
'FileSizeValidator' => [
'maxFileSize' => [
'type' => 'int',
'default' => null,
],
],
]

See also
  \eZ\Publish\Core\FieldType\FieldType::$validatorConfigurationSchema

Definition at line 27 of file Core/FieldType/BinaryBase/Type.php.

## ◆ $validators

eZ\Publish\Core\FieldType\BinaryBase\Type::$validators
| private

Definition at line 37 of file Core/FieldType/BinaryBase/Type.php.

Referenced by eZ\Publish\Core\FieldType\BinaryBase\Type\__construct().

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

- Core/FieldType/BinaryBase/Type.php

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