Hi,
let's say there are two models:
BasicEntry hasOne AdvancedEntry
AdvancedEntry belongsTo BasicEntry
In the advanced_entries table in the DB there is a field called
"basic_entry_id"
In views/basic_entries_edit.ctp there is something like this:
$form->input('BasicEntry.foo');
$form->input('AdvancedEntry.bar');
In the basic_entries_controller/edit method I have:
$this->BasicCity->save($this->data);
which saves only the data for the BasicEntry.
So I assumed I have to use saveAll() which doesn't work quite as I expected.
If I don't set $this->data['AdvancedEntry']['id'] manually before
saveAll I get an INSERT instead of an UPDATE.
I set the value with something like this:
$this->data['AdvancedEntry']['id'] =
$this->BasicEntry->AdvancedEntry->field('id', array(
'basic_entry_id' => $this->data['BasicEntry']['id']));
Do I really have to do this manually or is there an automagic cake-like way?
Regards
Guenther
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---