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

ImageAssetConverter.php
Go to the documentation of this file.
1 <?php
2
7 declare(strict_types=1);
8
9 namespace eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter;
10
11 use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter;
12 use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue;
13 use eZ\Publish\SPI\Persistence\Content\FieldValue;
14 use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition;
15 use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition;
16
17 class ImageAssetConverter implements Converter
18 {
25 public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
26 {
27 $storageFieldValue->dataInt = !empty($value->data['destinationContentId'])
28 ? $value->data['destinationContentId']
29 : null;
30 $storageFieldValue->dataText = !empty($value->data['alternativeText'])
31 ? $value->data['alternativeText']
32 : null;
33 $storageFieldValue->sortKeyInt = (int)$value->sortKey;
34 }
35
42 public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
43 {
44 $fieldValue->data = [
45 'destinationContentId' => $value->dataInt ?: null,
46 'alternativeText' => $value->dataText ?: null,
47 ];
48 $fieldValue->sortKey = (int)$value->sortKeyInt;
49 }
50
57 public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
58 {
59 }
60
67 public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
68 {
69 }
70
80 public function getIndexColumn()
81 {
82 return 'sort_key_string';
83 }
84 }
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageAssetConverter
Definition: ImageAssetConverter.php:18
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageAssetConverter\toFieldValue
toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
Converts data from $value to $fieldValue.
Definition: ImageAssetConverter.php:42
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageAssetConverter\toFieldDefinition
toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
Converts field definition data in $storageDef into $fieldDef.
Definition: ImageAssetConverter.php:67
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageAssetConverter\toStorageValue
toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
Converts data from $value to $storageFieldValue.
Definition: ImageAssetConverter.php:25
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageAssetConverter\getIndexColumn
getIndexColumn()
Returns the name of the index column in the attribute table.
Definition: ImageAssetConverter.php:80
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageAssetConverter\toStorageFieldDefinition
toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
Converts field definition data in $fieldDef into $storageFieldDef.
Definition: ImageAssetConverter.php:57
eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition
Definition: StorageFieldDefinition.php:12
eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue
Definition: StorageFieldValue.php:12
eZ\Publish\SPI\Persistence\Content\FieldValue
Definition: FieldValue.php:12
eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition
Definition: SPI/Persistence/Content/Type/FieldDefinition.php:18
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter
Converter for field values in legacy storage.
Definition: Persistence/Legacy/Content/FieldValue/Converter.php:18
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter
Definition: AuthorConverter.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.