...
Code Block |
---|
use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue; use eZ\Publish\SPI\Persistence\Content\FieldValue; // [...] public function toStorageValue( FieldValue $value, StorageFieldValue $storageFieldValue ) { $storageFieldValue->dataText = $value->url>data; $storageFieldValue->sortKeyString = $value->sortKey; } public function toFieldValue( StorageFieldValue $value, FieldValue $fieldValue ) { $fieldValue->url>data = $value->dataText; $fieldValue->sortKey = $value->sortKeyString; } |
...
Code Block | ||
---|---|---|
| ||
public function getIndexColumn() { return 'sort_key_string'; } |
Registering the converter
Just like a Type, a Legacy Converter needs to be registered and tagged in the service container.
The tag is ezpublish.storageEngine.legacy.converter
, and it requires an alias
attribute to be set to the FieldType identifier (eztweet
). Let's add this block to Resources/config/services.yml
:
Code Block | ||||
---|---|---|---|---|
| ||||
services:
ezsystems.tweetbundle.fieldType.eztweet.converter:
class: EzSystems\TweetFieldTypeBundle\eZ\Publish\FieldType\Tweet\LegacyConverter
tags:
- {name: ezpublish.storageEngine.legacy.converter, alias: eztweet} |
...
Section | |||||||
---|---|---|---|---|---|---|---|
|