create - creates a new instance of the model, this is especially helpful if
you are wanting to 'insert' more then one entry at a time, like looping
though a form that allows one to add more then one user at a time (for
example)  It is also useful to clear the information from a model  like if
you do a read earlier in the method code you might want to 'reset' it before
you 'save' your new data (like you might read the information from one user
because you use it in a 'child' user  (I do this when I have to do a
ModelName->find() to get an id for an existing record)

When in doubt and you are inserting, I would say use create, it can't hurt
and it can only help


On 5/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> What is the reason for using create in cake 1.2
> I am using cake 1.2 because it seems to have a lot of extra
> functionality, however i am making an application with information i
> learned from tutorials taht were for 1.1.
> I have updated my forms to use FormHelper instead of the html helper
> methods.  And i read someone say that the new cake uses create. I
> would guess that creates the object first or something.  for instance,
> i have some code:
>
> if ($this->User->save($this->data['User']))
>                         {
>                                 $this->flash('Your user information has
> been updated.','/users');
>                         }
> }
>
> would i do a create and then a save? It seems to work as is, but i'm
> wondering what the reason for using create before save would be.
> Thanks in advance.
>
>
> >
>


-- 
(the old fart) the advice is free, the lack of crankiness will cost you

- its a fine line between a real question and an idiot

http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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