I think you are right, but I wish I had a confirmation.

Thanks, anyway! :-)

On 28 jan, 22:30, "Sam Sherlock" <[EMAIL PROTECTED]> wrote:
> The first save is the Post the second the comment
>
> the post is save to return the post id required to save the linked comment
>
> as I understand anyway; someone with more cake knowledge may have something
> to add
>
> On 28/01/2008, 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to