Serialized field

Categories

Component ID

2113203

Component name

Serialized field

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

15382

Component created

Component changed

Component body

This is a helper module which declares a 'Serialized data' field type. This is designed to make it easy for modules to store arbitrary data on an entity.

No widgets or formatters are included for this field type - the assumption is that its value is usually updated programatically.

Ideas / Use cases

  • Data bin It works well as a general store of verbatim data. Similar in purpose to the "data' properties which exist on some core/contrib entity types (e.g. User, Commerce Order). With serialized_field you can create a field for this, rather than a custom DB property. And it is accessible/translatable/revisionable in the same way as other fields.
  • Fields "lite" You can think of it as a custom/aggregate field, but without worrying about DB schema. This may be useful if you need to store data on an entity-level, but see an advantage from keeping things "fast and loose". You would likely create a custom field widget to house the form for the data. Some reasons may include:
    1. Optimisation: If you're storing many (100s?) of individual values and don't want 100s of field tables
    2. Flexibility/RAD: If the data structure of the data is likely to change a LOT, you may be able to contrive a justification for this approach :)

Disadvantages / Limitations

  • Queriability The data is stored in a big serialised BLOB, so you can't filter/search over the field value,
  • Grokkability Devs expect things to be stored on entities in fields. Using this module will firmly set an advanced understanding of the Field API as a barrier to entry to development. Do not underestimate the significance of this. Always work to un-clever your codebase.