By the way, the code is a quote from the CakePHP Manual (Models
Chapter).
On Jan 28, 7:43 pm, Raistlin Majere <[EMAIL PROTECTED]> wrote:
> function add()
> {
> if (!empty($this->data))
> {
> // Here we save all post data.
> // If Comment is part of all post data, we save Comment.
>
> $this->Post->save($this->data);
>
> $post_id = $this->Post->getLastInsertId();
>
> $this->data['Comment']['post_id'] = $post_id;
>
> // Observe that Comment is part of Post.
> // Observe that Comment was saved and Comment is saved again.
>
> $this->Post->Comment->save($this->data);
>
> }
>
> }
>
> // Why save the Comment data twice?
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---