Hi Dave,
> Saving that way works, but then it ignores the HABTM relationship
> (which I thought was meant to process the link table, and multiple
> items automatically). Do you really have to save all three tables
> separately (or am I missing the point of HABTM here?)?
the data in the array is slightly different for HABTM associations,
basically it's:
$this->data['Tag']['Tag'] = array(2, 4, 10); // array of Tag.id's
check the manual page towards the bottom on saving HABTM associations.
Once you've got the theory, check out the bakery for articles/code
etc, as there's loads on there for dealing with HABTM (it's a common
source of frustration at the beginning)
One other thing, your table set up looks like the conventional, so you
don't need the extra params, a simple:
// in Image model
var $hasAndBelongsToMany = array('Tag');
// Tag
var $hasAndBelongsToMany = array('Image');
Also, a HABTM join is by it's very nature not unique, so I'm pretty
sure that parameter isn't available for this type of association.
hth
jon
--
jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---