Hi Mr Timp,
Yes, your example looks a bit old/odd. The "correct" equivalent of :
$this->User->data = $this->data;
is this:
$this->User->set($this->data);
This will ensure $this->User->id is updated with the correct value.
However, having said that, most of the code you've got seems unneeded.
Replace with something like this, which automatically calls set() and
validates().
function edit() {
if (!empty($this->data)) {
if ($this->User->save($this->data)) {
$this->Session->setFlash('Your details have been
updated');
$this->redirect('index');
} else {
$this->Session->setFlash('There was a problem updating
your
details, please try again shortly');
}
}
}
On Dec 14, 7:42 am, mr_timp <[email protected]> wrote:
> Hi There,
>
> Problem solved. $this->User->id was unset inside the controller -
> which is kinda weird. I have fixed it by doing the following:
>
> $this->User->id = $this->data["User"]["id"];
>
> Does it seems odd that I should have to do that? The example of code
> I'm using was taken from a supposed working application (maybe it was
> written for Cake 1.1 and I'm using 1.2)?.
>
> Cheers
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---