2

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?

3
  • 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 Jun 25 '15 at 10:25
  • Maybe it should be rephrased, then, to how the entity attribute 'data' is serialized and unserialized? Just wondering – Matt Glaman Jun 25 '15 at 12:09
  • Updated to reflect a question about how serialization/unserialization happens rather than a request for resources. – Jeremy John Jun 25 '15 at 14:47
2

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.

commerce_order.controller.inc#n135

/**
 * 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.