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

CheckboxConverter.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 CheckboxConverter implements Converter
16 {
26 public static function create()
27 {
28 return new self();
29 }
30
37 public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
38 {
39 $storageFieldValue->dataInt = (int)$value->data;
40 $storageFieldValue->sortKeyInt = (int)$value->data;
41 }
42
49 public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
50 {
51 $fieldValue->data = (bool)$value->dataInt;
52 $fieldValue->sortKey = $value->dataInt;
53 }
54
61 public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
62 {
63 $storageDef->dataInt3 = (int)$fieldDef->defaultValue->data;
64 }
65
72 public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
73 {
74 $fieldDef->defaultValue->data = !empty($storageDef->dataInt3) ? (bool)$storageDef->dataInt3 : false;
75 }
76
86 public function getIndexColumn()
87 {
88 return 'sort_key_int';
89 }
90 }
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter
Definition: CheckboxConverter.php:16
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter\getIndexColumn
getIndexColumn()
Returns the name of the index column in the attribute table.
Definition: CheckboxConverter.php:86
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter\toStorageFieldDefinition
toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef)
Converts field definition data in $fieldDef into $storageFieldDef.
Definition: CheckboxConverter.php:61
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter\toStorageValue
toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
Converts data from $value to $storageFieldValue.
Definition: CheckboxConverter.php:37
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter\create
static create()
Factory for current class.
Definition: CheckboxConverter.php:26
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter\toFieldDefinition
toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
Converts field definition data in $storageDef into $fieldDef.
Definition: CheckboxConverter.php:72
eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\CheckboxConverter\toFieldValue
toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
Converts data from $value to $fieldValue.
Definition: CheckboxConverter.php:49
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+.