Oh wait! Sorry, haha, this realization took way too long. Thanks a lot, it's ofcourse not an ingredient that is created everytime, just the association!
On 13 aug, 02:04, CakeSpork <[EMAIL PROTECTED]> wrote: > Thanks for the reaction. > > Yeah, I'm using 1.2. > > The problem with that approach is that for every quantity a new > ingredient is created, right? Or did I misunderstand? > I will want to link the ingredients to things like stores later, if > there is an ingedrient for every quantity, this will get terribly > difficult right? > > On 13 aug, 01:39, Marcin Domanski aka kabturek <[EMAIL PROTECTED]> > wrote: > > > > > are you using 1.2 ? > > search a little for the 'with' key in the association properties of a > > HABTM - you can define a model for the join table. and then you have a > > join table with id , ingredient_id, recipe_id , quantity. > > > i would do it that way if i understood you right :) > > > On Aug 13, 1:14 am, CakeSpork <[EMAIL PROTECTED]> wrote: > > > > At least, for *me* it's complex. Here's the situation: There's Users, > > > Drinks, Recipes and Ingredients. The idea is probably obvious: Users > > > get to add Drinks and Recipes (-which I continuously misspell as > > > Recipies, suggestion on that problem are welcome too) for those Drinks > > > with Ingredients. > > > > My idea: > > > User hasMany Drink,Recipe > > > Drink belongsTo User; hasMany Recipe > > > Recipe belongsTo User; hasAndBelongsToMany Ingredient > > > Ingredient hasAndBelongsTo Recipe. > > > > Now, here's where I'm stuck: Ingredient needs to have a quantity, I > > > don't want my visitors to leave them guessing on the most important > > > part. I was thinking of adding Ingredient hasAndBelongsToMany > > > Quantity, but I'm wondering how elegant it is saying 'quantity' is a > > > model (it just doesn't feel right) and more importantly, how I will > > > retrieve this information. It will be two deep from Recipes, where I > > > will access the information most. I'm anxious about the performance if > > > it is going to dig two deep in all the associated models (When I add > > > Ratings and Tags to Recipes, won't it retrieve all that information 2 > > > deep as well?) > > > > Anyone have a suggestion? > > > > Thanks!- Tekst uit oorspronkelijk bericht niet weergeven - > > > - Tekst uit oorspronkelijk bericht weergeven -- Tekst uit oorspronkelijk > > bericht niet weergeven - > > - Tekst uit oorspronkelijk bericht weergeven - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
