eZ\Publish\Core\Persistence\Legacy\Content\FieldValue\Converter\ImageConverter::toStorageValue PHP Method

toStorageValue() public method

Converts data from $value to $storageFieldValue.
public toStorageValue ( eZ\Publish\SPI\Persistence\Content\FieldValue $value, StorageFieldValue $storageFieldValue )
$value eZ\Publish\SPI\Persistence\Content\FieldValue
$storageFieldValue eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue
    public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
    {
        if (isset($value->data)) {
            // Determine what needs to be stored
            if (isset($value->data['width']) && isset($value->data['fieldId'])) {
                // width + field id set means that something really needs to be stored
                $storageFieldValue->dataText = $this->createLegacyXml($value->data);
            } elseif (isset($value->data['fieldId'])) {
                // $fieldId without width mleans an empty field
                $storageFieldValue->dataText = $this->createEmptyLegacyXml($value->data);
            }
            // otherwise the image is unprocessed and the DB field stays empty
            // there will be a subsequent call to this method, after the image
            // has been stored
        }
    }