Most probably your $id is empty as you did not passed it to action.

On Oct 12, 8:26 am, ajoberstar <[email protected]> wrote:
> So I've got a form that's got fields for both the model (Album) and
> its associated (hasMany) model (Track).  Anytime I use the edit form
> it does an add.  I'm assuming this is an issue with how my data is
> being passed to saveAll() but I can't figure it out (I'm pretty new to
> CakePHP).
>
> Here's what my edit action looks like in the AlbumsController.
>
> --------------------------------------------------------------------------- 
> -----------------------------------------
>
> function edit($id = null)
> {
>         $this->Album->id = $id;
>
>         if (empty($this->data))
>                 $this->data = $this->Album->read();
>         else if ($this->Album->saveAll($this->data, array('validate' =>
> 'first')))
>                 $this->redirect(array('action' => 'index'));
>         else
>                 $this->redirect($this-referer());
>
> }
>
> --------------------------------------------------------------------------- 
> -----------------------------------------
>
> Any help would be much appreciated.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to