Suppose that you have any validation, in your saveAll, you have to chance your this->data. First, if you used save, the correct is save ($this->data), and not $this->data['Recipe']. As you are using saveAll, your this->data must have similar to this below
$this->data = array( 0 => array(Recipe => array( info ) ) 1 => array(Recipe => array( another_info ) ) On 7 ago, 12:04, Luke <[email protected]> wrote: > Hi, > > I have a form to add recipes to a database. I have got a HABTM > Relationship and a hasMany. > > recipe HABTM subcategories > recipe hasMany ingredients > > In my controller I using the following: > > $this->Recipe->saveAll($this->data['Recipe']) > > This updates my Recipe table with the HABTM Relationship. After that I > decided to add this part > > if($this->Recipe->saveAll($this->data['Recipe'])){ > $this->Recipe->Ingredient->save($ingredient); > > } > > I now have two problems > 1. The if condition does not work out, so I never get to > $this->Recipe->Ingredient->save($ingredient); > > 2. But even when I just try out $this->Recipe->Ingredient->save > ($ingredient); the update is not working. > > I cant see what is going wrong. Any ideas? thanks a lot in advance. > > Luke --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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 -~----------~----~----~----~------~----~------~--~---
