My site has a backend that uses one function for CRU, and one for D on
most models. Most of the time I do a save if $this->data isn't empty
and then do a read at the end to populate the form with the results of
the save.
Recently, I needed to do read additional data in the same model before
the save. It looks something like this:
if(!empty($this->data)) {
$this->Product->id = $id
$data = $this->Product->read();
// Do something with $data and $this->data...
$this->Product->save();
}
//Read updated data back into form...
$this->params['data'] = $this->Product->read();
However, when I do this, the result of the second read is the same as
the first no matter what I save between them. This is also the case
when I use find instead.
I know that the model is updating because I can refresh the page
(without posting the data again) and the result of the original save
is shown. Note that when I remove the read before the save, everything
works correctly and the read at the end shows the result of the save.
Does anyone know what the deal is?
Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---