I am trying to update tables with a HABTM relationship.
When my join table looked like this:
CREATE TABLE IF NOT EXISTS `items_labels` (
`item_id` int(11) NOT NULL,
`label_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
... I could update the tables with $this->Item->save($data) where $data was:
Array
(
[Item] => Array
(
[id] => 1
)
[Label] => Array
(
[Label] => Array
(
[0] => 4
[1] => 5
[2] => 7
[3] => 8
)
)
)
I've added a column to my join table, so it now looks like:
CREATE TABLE IF NOT EXISTS `items_labels` (
`item_id` int(11) NOT NULL,
`label_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
When I am saving $data, I also want to save a user_id. The user_id will be
the same for all records in a single save operation.
Can someone show me what the $data array needs to look like in order to
incorporate the user_id? Thanks.
--
View this message in context:
http://n2.nabble.com/Saving-HABTM-records-when-not-all-join-table-columns-are-foreign-keys-tp2348416p2348416.html
Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---