Universal Data Storage

Categories

Component ID

2061243

Component name

Universal Data Storage

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Downloads

240

Component created

Component changed

Component body

This module provides an ability to store any objects or arrays with any nesting level in one database table.
Module provides entity called data_storage. Each entity has it's own entity_id so it could be loaded, saved or deleted using Entity API functions. Also each entity could be bind to another entity by id and special key. Each saving operation creates new revision so we won't lose your data. Your objects and arrays are stored in database as flat records so it's quite easy to join this data in your queries.

In other words this module is emulation of NoSQL Storage but stores data actually with using SQL databases.

  //Example. Saving whole $form_state['values'] array as data_storage entity
  $new_record = data_storage_create_record($form_state['values']); //Create special structured data_storage entity from array
  $new_record->bind_to = $node->nid; //We want our data to be bind to some node
  $new_record->fkey = 'form_state_data_of_my_module'; //Specify bind key. could be any string

  //And finally save our data
  entity_save('data_storage', $new_record);


  //Loading data
  $entities = data_storage_load_by_bind($node->nid, 'form_state_data_of_my_module'); //Specify our binded node id  and the key we had used before