When using that behavior, you must be sure when adding a new Tag to an Artist, that there already exists at least one other Tag for the Artist. The behavior should be modified to just add the new one. That is what I understand from looking at the source code.
You could also go for the solution, which is mentioned at the bottom of the page about saving HABTM data in the CakePHP book at: http://book.cakephp.org/view/1034/Saving-Related-Model-Data-HABTM Keep up the good work, enjoy, John On Aug 9, 8:27 pm, mr_robot <[email protected]> wrote: > hi john. yea it's 1. > > i have got it working another way with this kind of array: > $tags = array ( > 0 => array ( > 'Tag' => array ( > 'id' => 123458, > 'name' => 'test_tag3', > 'link' => 'xxx', > 'source' => 'yyy', > 'rank' => 2 > ), > 'Artist' => array ( > 'Artist' => array ( > 0 => 7 // this being the artist_id > ) > ) > ), > 1 => array ( > 'Tag' => array ( > 'id' => 123456, > 'name' => 'existing_tag', > 'link' => 'xxx', > 'source' => 'yyy', > 'rank' => 3 > ), > 'Artist' => array ( > 'Artist' => array ( > 0 => 7 // this being the artist_id > ) > ) > ), > ); > > but now it's deleting the already saved associations. > which leads me to this habtmAdd > behavior.http://bakery.cakephp.org/articles/bparise/2007/05/09/add-delete-habt... > seems like i'm on the right track. but > > $this->Artist->habtmAdd('Tag', 1, 123456); //artist_id=1, tag id = > 123456 > > does nothing. -- 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
