On 22 Jan 2007, at 10:54 AM, Bèr Kessels wrote:
I don't like the idea of storing a 'thing' in one table alone. Its not good for performance and horrible when you want to normalise your data.
Anyway, this is part of what the data api stuff i presented at DrupalCon tackled, you can see some example code in my sandbox (along with my slides). You would define one function (model_X), which would define the fields and constraints of the object. You can define multiple views (forms or displays) of the object by defining display_X or form_X functions. The fapi callbacks now become CRUD functions for the model. IE: create_X, load_X, update_X, delete_X. Just by defining the model, and at least one of the CRUD functions, fapi can automatically create a form for you. Instead of having node_load, etc. We would have one function drupal_load('X', $id, $id2, $id3); (or drupal_load('X', array(/* fields */)) ); Inside the drupal_load, drupal_delete etc functions, we would have a mechanism that manages the object table. IE: when inserting a node, it adds an entry into objects for type: node oid : 12 When loading a node, it also loads up the info from the object table. It'll also be able to load up any object using drupal_load('object', $oid); -- Adrian