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

EmailAddressConverter.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter;
8
9 use eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter;
10 use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue;
11 use eZ\Publish\SPI\Persistence\Content\FieldValue;
12 use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition;
13 use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition;
14
15 class EmailAddressConverter implements Converter
16 {
17 const VALIDATOR_IDENTIFIER = 'EmailAddressValidator';
18
28 public static function create()
29 {
30 return new self();
31 }
32
39 public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
40 {
41 $storageFieldValue->dataText = $value->data;
42 $storageFieldValue->sortKeyString = $value->sortKey;
43 }
44
51 public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
52 {
53 $fieldValue->data = $value->dataText;
54 $fieldValue->sortKey = $value->sortKeyString;
55 }
56
63 public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
64 {
65 $storageDef->dataText1 = $fieldDef->defaultValue->data;
66 }
67
74 public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
75 {
76 $validatorConstraints = [self::VALIDATOR_IDENTIFIER => []];
77 $fieldDef->fieldTypeConstraints->validators = $validatorConstraints;
78 $fieldDef->defaultValue->data = isset($storageDef->dataText1) ? $storageDef->dataText1 : '';
79 $fieldDef->defaultValue->sortKey = $fieldDef->defaultValue->data;
80 }
81
91 public function getIndexColumn()
92 {
93 return 'sort_key_string';
94 }
95 }
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\EmailAddressConverter
Definition: EmailAddressConverter.php:16
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\EmailAddressConverter\toStorageValue
toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
Converts data from $value to $storageFieldValue.
Definition: EmailAddressConverter.php:39
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\EmailAddressConverter\getIndexColumn
getIndexColumn()
Returns the name of the index column in the attribute table.
Definition: EmailAddressConverter.php:91
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\EmailAddressConverter\toFieldDefinition
toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
Converts field definition data in $storageDef into $fieldDef.
Definition: EmailAddressConverter.php:74
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\EmailAddressConverter\create
static create()
Factory for current class.
Definition: EmailAddressConverter.php:28
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\EmailAddressConverter\toFieldValue
toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
Converts data from $value to $fieldValue.
Definition: EmailAddressConverter.php:51
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\EmailAddressConverter\toStorageFieldDefinition
toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
Converts field definition data in $fieldDef into $storageFieldDef.
Definition: EmailAddressConverter.php:63
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\EmailAddressConverter\VALIDATOR_IDENTIFIER
const VALIDATOR_IDENTIFIER
Definition: EmailAddressConverter.php:17
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+.