Global navigation

   Documentation Center
   eZ Studio & eZ Platform
     User Manual
     Technical Manual
     Glossary
   eZ Publish 4.x / legacy

 
eZ Publish (5.x)

eZ Publish 5.x | For eZ Platform & eZ Studio topics see Technical manual and User manual, for eZ Publish 4.x and Legacy topics see eZ Publish legacy

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
languagephp
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
languagephp
titleResources/config/services.yml
services:
    ezsystems.tweetbundle.fieldType.eztweet.converter:
        class: EzSystems\TweetFieldTypeBundle\eZ\Publish\FieldType\Tweet\LegacyConverter
        tags:
            - {name: ezpublish.storageEngine.legacy.converter, alias: eztweet}

 

...

 

Section
Column
width50%

  Previous: Registering the FieldType as a service

Column

Next: Template implementation