It all depends! What is the requirement for owning items? Can a user own more than one of the same item?
What is the requirement for wanting items? Can a user want more than one of the same item? Can a want record expire - ie. the user wants the item, but only if the user can get it within X days/months/years? I would probably go for the two intersection tables between users and items, with the first storing all the owned items, one record each, and the second storing all the wanted items. When then the user gets the wanted item, I would remove it from the second and insert it into the first. Well, you can think about it. Enjoy, John On 12 Jan., 21:13, mklappen <[email protected]> wrote: > Hi All > > I'm having a little difficulty conceptualizing the relationships when > setting up a database/models, for a app I'm starting to develop. If > I'm creating a basic inventory management application I have the > following: > > Table Name | Columns > users | id, user_name, email, etc... > items | id, name, description, etc... > items_users | id, item_id, user_id > > I want a user to be able to mark items as "owns" or "wants" and a user > can own many items and items can be owned my many users. Similarly > "wants" would have same HABTM relationship between users and items. > > Now I can set up the HABTM relationship table "items_users" but that > will only get me one relationship between users and items. (either the > "owns" or "wants"). In order to get the second relationship type do I > need to set up a second relationship table? if so what would the > naming conventions be? > > Or do I add a another column to "items_users" table called > "itemstatus" and have values such as "owns", "wants", "owns & > wants"... > > More or less looking for the best approach and/or other suggestions. > > Thanks in advance. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
