Hi,
I had a few suggestions, but I should state that I have at times found
this simple task of saving data a bit confusing... these are just
suggestions.

First create or not?
saveField() calls create internally. Your create should not do much
one way or the other.
See: 
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/model.php#L1069

The manual states that you should set the id "just before" calling
saveField. One thing to note from that your sequence goes:
set the id
call verifyEmail
(call invalidate)
call saveField

Could Cake possibly do some "clean up" for you in the verification
code or invalidate?
Try moving the line setting id down to "just before" saveField. Two
copies is less dry but give it a try.

One this that has saved me a few times is read(). It costs you an
extra query to the db but I have found that it helps the "id" stick
around and not magically disappear. (This is one of those thing I have
found confusing)

Also, sometimes set() is not at all the same as just assigning the id
a value.
$this->User->id = $userObj['User']['id'];
$this->User->set($this->User->primaryKey, $userObj['User']['id']);

I have so far stayed away from set as much as possible... because it
confuses me sometimes. :)
But, that said, I have seen code that have made others happy (in
tests) by using set like this:
$this-> User->id = 1;
$this-> User->set('name', 'Martin');
$this-> User->save();


Since I haven't had your specific problem I can't know which of these,
if any, is likely to help you.
Good luck.
/Martin


On Dec 17, 10:27 am, "Amit Badkas" <amitrb...@gmail.com> wrote:
> It's not necessary that you must call create() method before inserting
> record. This method is used to reset model parameters like id, validation
> errors 
> etc.,https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/mod...
>
> 2008/12/17 gearvOsh <mileswjohn...@gmail.com>
>
>
>
> > I was only doing what the other guy suggested, I usually do not have
> > the create() method.
>
> --
> Amit
>
> http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to