Ok, you have tried that way, but maybe your problem wasn't explained correctly! Is your problem one of the following: 1) You want to add tags to an existing artist. The existing artist may already have some tags and they must be preserved. 2) You want to add a new set of tags to an existing artist, thus replacing all previous tags added to the artist (this is how HABTM normally works). 3) You want to do something different from 1 and 2 above.
In 1) you probably have to consider using a HasMany relationship between Artist and ArtistTag instead of the HABTM between Artist and Tag. In 2) you can save more than one tag with each Artist. Just add each tag to your array and save the Artist. In 3) more information is needed :) Enjoy, John On Aug 9, 4:13 pm, mr_robot <[email protected]> wrote: > so found a solution. sort of. after building some forms and looking at > the output, i see the format as follows: > > [Tag] => Array > ( > [name] => final2 > [rank] => > ) > > [Artist] => Array > ( > [Artist] => Array > ( > [0] => 1903895 > [1] => 1903896 > ) > > ) > > so have been trying to reconstruct the array, which works: > > foreach($artist['Tag'] as $tag){ > $t['Tag'] = $tag; > $t['Artist']['Artist'][0] = $artist['Artist']['id']; > //print_r($t); > //$this->Tag->saveAll($artist['Tag']); > $this->Tag->create(); > //$this->Tag->save($t, false); > $this->Tag->save($t); > > } > > however, it is not saving the tags in the artist_tags table if the > tags already exist. ie. the validation is stopping the record from > being saved. > > any ideas? > this also seems to be a very long winded way of doing things. am i > still missing something? -- 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
