Post the controller code where you do the find, and what the data
output is, and it will be easier for someone to answer your question.
On Jan 28, 1:29 pm, matth <matt...@gmail.com> wrote:
> Thanks for that tidbit about the Ingredient model.
>
> I gave recursive a shot earlier in the day but that didn't help. At
> the moment, this is exactly what I'm working with:
>
> class Recipe extends AppModel
> {
> var $name = 'Recipe';
> var $primaryKey = 'id';
> var $recursive = 2;
>
> var $hasAndBelongsToMany = array(
> 'Ingredient' => array(
> 'className' => 'Ingredient',
> 'joinTable' => 'ingredients_recipes',
> 'foreignKey' => 'recipe_id',
> 'associationForeignKey' => 'ingredient_id',
> 'unique' => true,
> )
> );
>
> }
>
> On Jan 28, 3:15 pm, yusuf widi <wmo...@gmail.com> wrote:
>
> > no, it is ok if your ingredient model is empty...
> > try to give recursive parameter with '2' when you use find method. by
> > default recursive parameter is null.
>
> > read more about recursive is on the api.cakephp.orghttp://api.cakephp.org/class/model#method-Modelfind
>
> > On Thu, Jan 29, 2009 at 4:46 AM, matth <matt...@gmail.com> wrote:
>
> > > Howdy,
> > > I'm having trouble fully wrapping my head around Cake's models. They
> > > seem great and I'm really working to figure out how to take advantage
> > > of all the benefits.
>
> > > However, I can't quite figure out how to set up my models
> > > appropriately. For example, I have two models (Recipe and Ingredient)
> > > and I have defined they following relationship in my Recipe model:
>
> > > var $hasAndBelongsToMany = array(
> > > 'Ingredient' => array(
> > > 'className' => 'Ingredient',
> > > 'joinTable' => 'ingredients_recipes',
> > > 'foreignKey' => 'recipe_id',
> > > 'associationForeignKey' => 'ingredient_id',
> > > 'unique' => true,
> > > )
> > > );
>
> > > But I'm not able to retrieve my ingredients. So what's the deal? Is
> > > something wrong with my table setup? Do I need to modify my Ingredient
> > > model (because it's empty)?
>
> > --http://www.wmonou.com
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment