以下情形:CakePHP的:复杂的连接模型
Recipe hasMany RecipeItem
RecipeItem belongsTo Recipe, Ingredient
(Ingredient
可以与hasMany RecipeItem
有关,但我并不需要这种关系)
所以基本上,一个单面HABTM没有加入表,因为我的加入元素(RecipeItem
)需要有一个附加属性:count。
这篇文章:http://book.cakephp.org/1.3/view/1650/hasMany-through-The-Join-Model描述如何创建/保存一次或完全分开。我想要的是创造一方(成分)分开,另一方(食谱)与协会一起。创建新配方时,您可以选择多种配料。
你会如何做到这一点? 谢谢。
尝试http://cakeapp.com – powtac 2012-08-19 13:27:48