Sunday, August 30, 2009

Re: Save HABTM, Undefined index: id

Thanks Martin! That works. Not quite sure why, but I've added an
'id' field to my join table. For the multi-saves, there's no error,
but nothing is written to the field? Anyhow, I appreciate your help.

Wilson

On Aug 17, 4:02 am, Martin Westin <martin.westin...@gmail.com> wrote:
> Which model doesn't have anidfield?
>
> If it has an pk or uid or some other name you should just let Cake
> know via the attribute $primaryKey.
> The join-table can manage without any primary key as long as you don't
> store any extra data in it. But this is not encouraged, it seems to be
> considered as smart as smoking cigarettes and drinking lighter-fluid
> at the same time. (I tried to discuss the point a while back.)
>
> But, since you mention a position value in the joining table you do
> need anidthere to make Cake happy.
>
> On Aug 17, 12:31 am, Wilson Sheldon <wil...@namedia.net> wrote:
>
> > Hi everyone,
>
> > Anytime I save a HABTM relationship, I always get this error:
>
> >Notice(8):Undefinedindex:  id
>
> > Everything works, but of course, this is annoying when I'm not in
> > production mode.  There is no plain 'id' in the model.
>
> > Done a bit of research on it, and found a few others who mention it,
> > but can't find answer, so just normally suppress it.
>
> > I think it's related to the fact, that I often store the position in
> > the join table.
>
> > Has anyone experienced this?  And if so, is there a workaround or a
> > better way to store the position?
>
> > I've also thought it might be something to do with theindexon my
> > join table?
>
> > Thanks,
> > Wilson
>
>
--~--~---------~--~----~------------~-------~--~----~
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: