| @@ 68-81 (lines=14) @@ | ||
| 65 | * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDef |
|
| 66 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef |
|
| 67 | */ |
|
| 68 | public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) |
|
| 69 | { |
|
| 70 | if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minFloatValue'])) { |
|
| 71 | $storageDef->dataFloat1 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minFloatValue']; |
|
| 72 | } |
|
| 73 | ||
| 74 | if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['maxFloatValue'])) { |
|
| 75 | $storageDef->dataFloat2 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['maxFloatValue']; |
|
| 76 | } |
|
| 77 | ||
| 78 | // Defining dataFloat4 which holds the validator state (min value/max value) |
|
| 79 | $storageDef->dataFloat4 = $this->getStorageDefValidatorState($storageDef->dataFloat1, $storageDef->dataFloat2); |
|
| 80 | $storageDef->dataFloat3 = $fieldDef->defaultValue->data; |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Converts field definition data in $storageDef into $fieldDef. |
|
| @@ 68-81 (lines=14) @@ | ||
| 65 | * @param \eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition $fieldDef |
|
| 66 | * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldDefinition $storageDef |
|
| 67 | */ |
|
| 68 | public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageFieldDefinition $storageDef) |
|
| 69 | { |
|
| 70 | if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minIntegerValue'])) { |
|
| 71 | $storageDef->dataInt1 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['minIntegerValue']; |
|
| 72 | } |
|
| 73 | ||
| 74 | if (isset($fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['maxIntegerValue'])) { |
|
| 75 | $storageDef->dataInt2 = $fieldDef->fieldTypeConstraints->validators[self::FLOAT_VALIDATOR_IDENTIFIER]['maxIntegerValue']; |
|
| 76 | } |
|
| 77 | ||
| 78 | // Defining dataInt4 which holds the validator state (min value/max value/minMax value) |
|
| 79 | $storageDef->dataInt4 = $this->getStorageDefValidatorState($storageDef->dataInt1, $storageDef->dataInt2); |
|
| 80 | $storageDef->dataInt3 = $fieldDef->defaultValue->data; |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Converts field definition data in $storageDef into $fieldDef. |
|