module for managing multi-dimensional node objects

tags:

I've got a problem I'm trying to solve.

I want to a module to manage inter-related data sets.

Imagine a chain of retail stores that carry different products and have a multiple ongoing sales. We'll call the module "storemanager".

Each store will have its own properties along with various active sales and its own unique products. Each sale will have properties plus a list of products that make up the sale. One or more stores may have the same sale. Finally, products will have properties, and they may be present at one or more stores and in one or more sales.

Since all of these objects depend on one another, I want to keep them in a single module, storemanager.

Drupal modules typically deal with a single object (story, image, forum, comment, etc..). Some of these objects have simple, one-to-one, relationships with other objects (a comment always has a parent node, for example).

These relationships are easy enough to manage from a database perspective. Managing each individual object can easily be done with a little OO. But how to handle a multi-faceted node type in a single module is not so obvious.

Each object will require its own hooks, forms, templates, etc. I need some way to enable multiple hooks within a single module. For hook_form, for example, I'd like to be able to create:

  • storemanager_store_form
  • storemanager_sale_form
  • storemanager_product_form

But I don't believe that is currently possible.

Because all three object types are required for the storemanager module to work, I don't want to rely on the user to have to enable 3 different modules. I also don't want to needlessly clutter up the admin/modules page

One solution might be to create four separate modules, one for each of the objects and one "abstract" module that wraps the other three into one interface. I don't know if this is possible.

 

The e-commerce module uses the multiple-module approach.

The acidfree module uses one module for different node types.

Either approach could work, but I would probably opt for multiple modules.

-Corey