Tuesday, September 30, 2008

Re: how to save twice??

Hi rocket,

> I am trying to save an entry twice after getting processed.
>
> Ideally the query would look like
>
> $this->Post->save($this->data()); // the first save, so in the mySQL
> db it will have id 1
> $this->Post->save($this->data()); // a second save, so another row
> with id 2
>
> However it doens't seem to work correctly.
> Does anyone knwo what I'm doing wrong?
>
> also, i'm on 1.1x

Call $this->Post->create() before the second save() to reset the
models state.

Hope that helps!

--
Daniel Hofstetter
http://cakebaker.42dh.com
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: