I've searched google and the Drupal API, but I can't seem to find documentation for the data array that serializes/unserializes automatically that is attached to entities and stored in the data column on some entities, particularly commerce_order. Searching for the world "data" is like searching for the word "the." Where/how is the data array serialized and unserialized?

  • 4
    I'm voting to close this question as off-topic because it's a "requests for tutorials and other online resources", forbidden in Help Center.
    – Mołot
    Commented Jun 25, 2015 at 10:25
  • Maybe it should be rephrased, then, to how the entity attribute 'data' is serialized and unserialized? Just wondering Commented Jun 25, 2015 at 12:09
  • Updated to reflect a question about how serialization/unserialization happens rather than a request for resources. Commented Jun 25, 2015 at 14:47

1 Answer 1


The data attribute is part of the Commerce Entity definitions, and I think this might be part of the larger de facto Entity API setup for contrib entities (don't quote me on that ;).)

If you want to find the documentation on properties and how they are handled you need to review the EntityController class, which each Commerce module has in its includes folder.


 * Unserializes the data property of loaded orders.
public function attachLoad(&$queried_orders, $revision_id = FALSE) {
  foreach ($queried_orders as $order_id => &$order) {
    $order->data = unserialize($order->data);

The database layer automatically serializes, if I recall correctly. However controllers need to unserialize.

Hopefully this this question and other entity related items (also make sure to review hook_entity_info() implementation.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.