I think maybe the difference between what you and I was doing is that
I was trying to save multiple "main" records at one time, whereas you
were doing one.

$this->data[1]['Recipe']['name'] = 'Delicious apple pie';
$this->data[1]['Recipe']['serves'] = 6;
$this->data[1]['Recipe']['valid'] = 1;
$this->data[1]['Tag'][0]['tag_id']=4;
$this->data[1]['Tag'][1]['tag_id']=2;
$this->data[1]['Tag'][2]['tag_id']=3;
$this->data[1]['Recipe']['name'] = 'Pork spare ribs';
$this->data[1]['Recipe']['id'] = 166;
$this->data[1]['Recipe']['serves'] = 4;
$this->data[1]['Recipe']['valid'] = 1;
$this->data[1]['Tag'][0]['tag_id']=1;
$this->data[1]['Tag'][1]['tag_id']=5;
$this->data[1]['Tag'][2]['tag_id']=9;


-------------------------------------------------------------

Once I added the hasMany ingredients that broke and I had to loop
through
the data and save each one individually:

foreach ($this->data as $save)
{
    $this->saveAll($save);
}

So $save would look like this:

$save['Recipe']['name'] = 'Delicious apple pie';
$save['Recipe']['serves'] = 6;
$save['Recipe']['valid'] = 1;
$save['Tag'][0]['tag_id']=4;
$save['Tag'][1]['tag_id']=2;
$save['Tag'][2]['tag_id']=3;
$save['Ingredient'][0]['name']='sugar';
$save['Ingredient'][1]['name']='apples';

and so on...
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to