> After reading over the API and cookbook, I believe both are perfectly
> correct (save vs create). Inserting $this->data within the parameter
> list of Model::create() is unnecessary in most circumstances, but will
> work. I think Model::create() was intended to solve specific issues
> that would be difficult to solve with only Model::save().
Well, they do exactly the same thing, except as I understood it, it
was preferred to use $this->Model->set($data); to pass the data to the
model, create allows you to bypass this step:
// Creating
$data = array('sadasdasdasdad');
$this->Model->create($data);
$this->Model->save() or $this->Model->saveAll();
// Updating
$data = $this->Model->read(null, $id);
$this->Model->set($data);
$this->Model->save() or $this->Model->saveAll();
Anyone from the team want to comment on the _correct/desired_ way to
approach this?
Cheers,
Jon
--
jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
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:
Post a Comment