Welcome Guest, Not a member yet? Register   Sign In
Need help modeling a very simple scenario with DataMapper ORM
#2

[eluser]WanWizard[/eluser]
First problem is in your relationship tables:

products_extras -> extras_products
products_orders -> orders_products

Table names are combined in alphabetical order, so e for p, and o for p.

As to your 'foo' question, the column names in there confuse me. A column called 'dishes_orders_id' suggests you have a model called 'dishes_orders' somewhere, but it's not in your list.

If it's goal is to register a special price for a specific combination of order and extra, it defined a many to many between order and extra, and it would be logical to call it extras_orders, containing 'extra_id' and 'order_id'.

And maybe a tip:

If you intent to work a lot with join fields (extra columns in relationship tables), it might be worthwhile to look into breaking up your many to many relations, and make a model for the relationship table (which will then have a has_one to both parents).

This will allow you to query them via their model objects, instead of the quite complicated join fields construction.


Messages In This Thread
Need help modeling a very simple scenario with DataMapper ORM - by El Forum - 05-09-2012, 01:01 PM



Theme © iAndrew 2016 - Forum software by © MyBB