Unlike eZ Publish Legacy, eZ Platform supports (by design) multiple storage engines. The main, and almost only one right now is the Legacy Storage Engine, based on the legacy database, with a new implementation. Since each storage engine may have its own way of storing data, you need to map each Field Type value to something legacy can understand.

We will implement a Field Type Converter, each storage engine defining its own interface for those.

The legacy storage engine uses the ezcontentobject_attribute table to store Field values, and ezcontentclass_attribute to store Field definition values (settings, etc.). They are both based on the same principle.

Each row represents a Field or a FieldDefinition, and offers several free fields, of different types, where the type can store its data:

ezcontentobject_attribute offers 3 fields for this purpose:

data_int

data_text

data_float

ezcontentclass_attribute offers a few more:

four data_int (data_int1 to data_int4) fields

four data_float (data_float1 to data_float4) ones

five data_text (data_text1 to data_text5)

Each type is free to use those fields in any way it requires. Converters will map a Field’s semantic values to the fields described above, for both settings (validation + configuration) and value.

The first two methods you have implemented apply to a Field’s value, but you also need to convert your Field’s definition. For example, a TextLine’s max length, or any FieldDefinition option.

This is done using toStorageDefinition() that converts a FieldDefinition into a StorageFieldDefinition. toFieldDefinition() does the opposite. In this case, you actually don’t need to implement those methods since your Tweet Type doesn’t have settings:

In toFieldValue() and toStorageValue() you have used the sortKeyString property from StorageFieldValue. getIndexColumn() will tell provide the legacy storage engine with the type of index / sort column it should use: string (sort_key_string) or int (sort_key_int). Depending on which one is returned, the system will either use the sortKeyString or the sortKeyInt properties from the StorageFieldValue.