Sunday, November 6, 2011

Re: CakePHP2.0.1 - Problem with saving HABTM

> Ok, I've upgraded to 2.0.2, changed the code of
> EpisodeReleaseController.php, and i have fixed the add problem. Now I
> am building the edit function. I have used the console cake bake
> controller to create it, but it seems that each time I press save it
> adds a new association.
> Example;
> "Post" as been added with "TagA" and "TagC". I edit it and in the
> multiple select I deselect the "TagC" and select the "TagB". I'd
> expect now to have only "TagA" and "TagB", but if I press save it
> shows: "TagA,TagC,TagA,TagB".

Hmm, could you post your edit view and your model please.
Also, you should probably have a unique index against the two foreign
keys in your join table to stop duplicate joins being created in the
first place:

CREATE UNIQUE INDEX idx_episode_releases_episode_release_id_tag_id ON
episode_releases(episode_release_id,tag_id);

hth

J

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate