Ahh! Yes, that's exactly what I needed to know - "many to many." Thank you very much, I haven't gotten to that day on Jobeet just yet, looks like I was jumping the gun!
On Aug 23, 5:53 pm, Daniel Lohse <[email protected]> wrote: > You are going to model this as a many-to-many relation between a (one) Recipe > and its (many) Ingredients where each Recipe can have an infinite number of > ingredients and one ingredient can belong to an infinite number of recipes. > :) You'll find a description of how to do many-to-many relationships in the > Jobeet tutorial. Hopefully this makes more sense when you do read it. > > PS: Yes, you could also model this as a one-to-many relation between Recipe > and Ingredient but then the ingredient "milk" would be duplicated over and > over again (because the ingredient would save the ID of the recipe it belongs > to and can hence only save one parent (recipe)) and could not have attributes > of its own that could be changed independently of the recipes. That would > lead so serious duplication. > > Hope that helps, > Daniel > > On 23.08.2010, at 23:44, json2001 wrote: > > > > > I'm very new to symfony, in fact I'm still reading the gentle intro > > and working through Jobeet, and this question is probably very simple > > (I hope!) as I image this comes up all the time. > > > Users will be creating recipes. I would like to keep another table of > > ingredients for autocompletion on the Create Recipe form. > > > Clearly, not all recipes have the same number of ingredients and I > > can't imagine having a recipe table that has ingredient_id_1, > > ingredient_id_2, ingredient_id_3, etc! So, how can I store an > > arbitrary number of ingredients to a single field- "ingredient_ids." > > Is there a way to store an array? Or is it typical to just use a coma > > separated listing and parse it in the model? > > > Thanks.Really just looking for best practice sorts of advice at this > > point so I can start to wrap my head around the method. > > > -- > > If you want to report a vulnerability issue on symfony, please send it to > > security at symfony-project.com > > > You received this message because you are subscribed to the Google > > Groups "symfony users" 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/symfony-users?hl=en -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" 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/symfony-users?hl=en
