Welcome Guest, Not a member yet? Register   Sign In
Help with datamapper database design and structure
#2

[eluser]North2Alaska[/eluser]
[quote author="Andy78" date="1334156496"]Looking at my diagram how should orders really be related to foods? Some kind of join table?[/quote]

With the idea that a food item can be on many orders and many orders have the same one food, you have a many to many relationship. Therefore, you need a table between the two. For DM it would be food_orders (or is that foods_orders?) it would have three columns; id, food_id, order_id.

And then in your food model you would have:
$has_many = array('order');

and in your order model you would have:
$has_many = array('food');


Messages In This Thread
Help with datamapper database design and structure - by El Forum - 04-11-2012, 08:01 AM
Help with datamapper database design and structure - by El Forum - 04-11-2012, 08:33 AM
Help with datamapper database design and structure - by El Forum - 04-11-2012, 08:45 AM
Help with datamapper database design and structure - by El Forum - 04-11-2012, 08:58 AM
Help with datamapper database design and structure - by El Forum - 04-12-2012, 07:22 AM
Help with datamapper database design and structure - by El Forum - 04-12-2012, 07:54 AM
Help with datamapper database design and structure - by El Forum - 04-12-2012, 10:38 AM
Help with datamapper database design and structure - by El Forum - 04-12-2012, 10:51 AM
Help with datamapper database design and structure - by El Forum - 04-12-2012, 11:04 AM
Help with datamapper database design and structure - by El Forum - 04-13-2012, 04:37 AM
Help with datamapper database design and structure - by El Forum - 04-13-2012, 07:36 AM
Help with datamapper database design and structure - by El Forum - 04-13-2012, 09:27 AM
Help with datamapper database design and structure - by El Forum - 04-13-2012, 10:34 AM
Help with datamapper database design and structure - by El Forum - 04-16-2012, 02:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB