Well, you're quite welcome ;-)

First of all, when using Model::save, only data for the model itself,
as well as links to any hasAndBelongsToMany associations.  So if the
model has data for other associated models, you have to save it
manually.

Let's say you have two models: Post hasMany Comment, and you wanted to
create a Post record, and an associated Comment record.  Assuming you
had set up the appropriate form fields for both, you could do the
following:

if ($this->Post->save($this->data)) {
    $this->Post->Comment->set("post_id", $this->Post->id);
    $this->Post->Comment->save($this->data);
}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to