Converts a $value to a persistence value.

@param \eZ\Publish\Core\FieldType\MapLocation\Value $value

@return \eZ\Publish\SPI\Persistence\Content\FieldValue
339662
public function toPersistenceValue(SPIValue $value)
    {
        return new FieldValue(
            array(
                'data' => null,
                'externalData' => $this->toHash($value),
                'sortKey' => $this->getSortInfo($value),
            )
        );
    }
1320918
public function convertFieldValueToForm(Value $value, FieldDefinition $fieldDefinition = null)
    {
        $time = $value->time;
        if (is_int($time)) {
            return new DateTime("@$time");
        }

        return new DateTime();
    }
390804
public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
    {
        if (empty($value->dataText)) {
            // Special case for anonymous user
            return;
        }
        $fieldValue->data = $this->parseLegacyXml($value->dataText);
    }
1062257
public function value($value)
    {
        // Set the value using parent, so that if there is already one specified
        // from populate or POST
        parent::value($value);

        // Set the value of the subfields
        $this->date->value($value);
        $this->time->value($value);

        // Chainable
        return $this;
    }
47513
protected function normalizeValue($value)
    {
        $normalizedValue = $value;
        // object value
        if (is_object($value)) {
            if (get_class($value) === "DateTime") {
                $normalizedValue = $value->format("Y-m-d\TH:i:s.u\Z");
            } elseif ($value instanceof DataContainerInterface || method_exists($value, 'normalizeData')) {
                $normalizedValue = $value->normalizeData();
            } else {
                throw new PropertyValueNormalizationException(
                    "Value error: object of type [" . get_class($value) . "]
                    does not implement DataContainerInterface nor have a [normalizeData] method"
                );
            }
        } elseif (is_array($value)) {
            foreach ($value as $arrProperty => $arrValue) {
                $normalizedValue[$arrProperty] = $this->normalizeValue($arrValue);
            }
        }

        return $normalizedValue;
    }
1195556
public function map( $key, $value = null )
    {
        Option::set( $this->_map, $this->_hashKey( $key ), $value );

        return $this;
    }
546293
public function convertToPHPValue($value, AbstractPlatform $platform)
    {
        if ($value === null) {
            return null;
        }

        return new File(static::$basePath . $value);
    }
327095
public function map(ValueObject $value): RoleCreateData
    {
        if (!$value instanceof RoleCreateStruct) {
            throw new InvalidArgumentException('value', 'must be an instance of ' . RoleCreateStruct::class);
        }

        $data = new RoleCreateData();

        $data->setIdentifier($value->identifier);

        return $data;
    }
843195
public function setUnserializeUndeclaredPropertyMode($value)
    {
        $availableOptions = [
            static::UNDECLARED_PROPERTY_MODE_SET,
            static::UNDECLARED_PROPERTY_MODE_IGNORE,
            static::UNDECLARED_PROPERTY_MODE_EXCEPTION
        ];
        if (!in_array($value, $availableOptions)) {
            throw new InvalidArgumentException('Invalid value.');
        }
        $this->undefinedAttributeMode = $value;
        return $this;
    }
681628
private function serializeValue($value)
    {
        if (is_object($value)) {
            return $this->serializeObjectRecursively($value);
        } elseif (is_array($value)) {
            return $this->serializeArrayRecursively($value);
        }

        return $value;
    }
1166116
public function setValue($value)
    {
        $value = $this->preformatValue($value);
        $manager = $this->getManager();
        $manager->clean();
        foreach ($value as $linkModel) {
            if (
                false === ($linkModel instanceof ModelInterface) &&
                !is_a($linkModel, $this->modelClass)) {
                $linkModel = call_user_func([$this->modelClass, 'objects'])->get(['pk' => $linkModel]);
            }

            if ($linkModel instanceof ModelInterface) {
                $manager->link($linkModel);
            } else {
                throw new Exception('ManyToMany field can set only arrays of Models or existing primary keys');
            }
        }
    }
381089
public static function convertDist($value)
    {
        if (\is_array($value)) {
            $data = (array) $value;
            $value = array();

            foreach ($data as $type => $url) {
                if (\is_string($url)) {
                    self::convertDistEntry($value, $type, $url);
                }
            }
        }

        return $value;
    }
112744
public function convertFromValue(Value $value)
    {
        $hash = array();

        foreach ($value->page->getState() as $propName => $propValue) {
            switch ($propName) {
                case 'layout':
                    if ($propValue !== null) {
                        $hash['layout'] = $propValue;
                    }
                    break;
                case 'attributes':
                    if ($propValue !== null && $propValue !== array()) {
                        $hash['attributes'] = $propValue;
                    }
                    break;
                case 'zones':
                    foreach ($propValue as $zone) {
                        $hash['zones'][] = $this->convertZoneToHash($zone);
                    }
                    break;
            }
        }

        return $hash;
    }
359867
protected function convertValueForColumn($value, ColumnMap $colMap)
    {
        if ($colMap->getType() == 'OBJECT' && is_object($value)) {
            if (is_array($value)) {
                $value = array_map('serialize', $value);
            } else {
                $value = serialize($value);
            }
        } elseif ('ARRAY' === $colMap->getType() && is_array($value)) {
            $value = '| ' . implode(' | ', $value) . ' |';
        } elseif (PropelTypes::ENUM === $colMap->getType() && !is_null($value)) {
            if (is_array($value)) {
                $value = array_map([$colMap, 'getValueSetKey'], $value);
            } else {
                $value = $colMap->getValueSetKey($value);
            }
        } elseif ($colMap->isSetType() && !is_null($value)) {
            try {
                $value = SetColumnConverter::convertToInt($value, $colMap->getValueSet());
            } catch (SetColumnConverterException $e) {
                throw new PropelException(sprintf('Value "%s" is not accepted in this set column', $e->getValue()), $e->getCode(), $e);
            }
        }

        return $value;
    }
399187
public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
    {
        $data = trim($value->dataText);
        $fieldValue->data = empty($data) ? array() : explode(',', $data);
    }
204267
public function map($value/*, $value2, ... */)
    {
        $args = func_get_args();
        foreach ($this->getMaps() as $name => $map)
        {
            yield $name => call_user_func_array($map, $args);
        }
    }
72935
public function serialize($value)
    {
        $this->noMappingGuard();

        //LEGACY ARRAY SERIALIZATION
        if (\is_array($value) && !empty($value[Serializer::MAP_TYPE])) {
            $data = $this->legacySerializeArray($value);

            return $this->outputStrategy($data);
        }

        //HAL PAGINATION SERIALIZATION
        if (!empty($value[Serializer::CLASS_IDENTIFIER_KEY])) {
            if ($value[Serializer::CLASS_IDENTIFIER_KEY] === HalPagination::class) {
                foreach ($value[self::EMBEDDED_KEY][Serializer::SCALAR_VALUE] as $k => $v) {
                    $value[self::EMBEDDED_KEY][Serializer::SCALAR_VALUE][$k] = $this->serializeObject($v);
                }
            }
        }

        //HAL SERIALIZATION
        $data = $this->serializeObject($value);

        return $this->outputStrategy($data);
    }