I'm using CakePHP to build an application using the MVC Pattern, but my question is language agnostic, I guess.
Here's an overview of a part of my data:
ITEMS (id, name, description)
LOCATIONS (id, name)
The items table describes a type of item ("apple", "orange", "banana"), not individual items.
Each location can have any number of each item. To hold this many-to-many relationship, I have this table:
ITEMS_LOCATIONS (id, item_id, location_id, quantity)
// eg (1, "home", "apple", 5) --> I have 5 apples at home
// (2, "work", "apple", 2) --> I have 2 apples at work
// (1, "home", "orange", 1) --> 1 orange at home
// (Don't worry - I have numeric ids... this is just an example)
Now I need to be able to edit this "inventory" information, but I'm not sure exactly which model or controller should be handling it?
Should the locations
controller have an editInventory
action? Or should the items
controller have editLocations
or what? Should I make a brand new model?