HMVC best practice - calling models in other modules triads?

Another question related to HMVC pattern (I'm using Modular Extensions):

In my database I have a 'categories' table which I need to interact with from different modules (MVC triads), eg.

* Module A: Returns a 'search widget' where user can check which categories to be included in a search.
* Module B: A navigational tab with links to each category.
* Module C: Admin interface for creating/deleting categories

The question - should I:

implement the database interaction with the 'category' table in each module's model?
This would mean duplicate code: modules A to C would all need to have a model method like 'get_categories()' doing the pretty much the same query in the db.

Put the interaction with the categories table in it's own module - 'Categories Module' - and have the other modules call 'Categories Module' whenever categories data is needed. This seems like the right way from a maintenance point of view, but I'm not sure if this would break the HMVC philosophy of complete compartmentalizing / modularing.

c) Something else?

(I have read different introductions to HMVC on the net, but I can't really grasp what I'm supposed to do here)


Messages In This Thread
HMVC best practice - calling models in other modules triads? - by El Forum - 08-13-2010, 03:56 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.