Here is the magic trick, how to save some extra data in joining table:
http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/

Is this magic still working in 1.3? Or something has changed in saving
behavior for HABTM? I'm asking, because when I do:
Product HABTM Shop

Saving new Product with that trick:
$this->data['ProductsShop'][0]['shop_id'] = '4';
$this->data['ProductsShop'][0]['name'] = 'acne';
$this->Product->bindModel(array('hasMany' => array('ProductsShop')));

I get 2 SQL queries:
19      INSERT INTO `products_shops` (`product_id`,`shop_id`) VALUES
(5,'4')         1               0
20      INSERT INTO `products_shops` (`product_id`, `shop_id`, `name`,
`modified`, `created`) VALUES (5, 4, 'acne', '2009-11-18 21:56:40',
'2009-11-18 21:56:40')

And of course 2 rows in products_shops table. Any ideas?

--

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.


Reply via email to