hi bakers,

I have search for ages on this one.  And i have a partial solution.

Problem:
--------------------
I have a table that has two HABTM table off it ([URL=http://
img170.imageshack.us/my.php?image=schemavo5.gif][IMG]http://
img170.imageshack.us/img170/2968/schemavo5.th.gif[/IMG][/URL])

The bundle form has 2 multiselect combos in them, showing all products
and campaigns.

If i select 4 products and 1 campaign and hit save.  I see the 4
products have been inserted into the bundles_products ok.  BUT i also
see 5 inserts in the bundles_campaigns table. When it should be only
1.

I hope that makes sense.

Here are the models:

Campaign
----------------
var $hasAndBelongsToMany = array(
                        'Bundle' =>
                                 array('className' => 'Bundle',
                                                'joinTable'    => 
'bundles_campaigns',
                                                'conditions' => '',
                                                'order' => '',
                                                'foreignKey' => 'campaign_id',
                                                'associationForeignKey'=> 
'bundle_id',
                                                'uniq'         => true,
                                                'conditions'   => '',
                                                'finderQuery'  => '',
                                                'deleteQuery'  => ''));

Product
-------------
var $hasAndBelongsToMany = array(
                        'Bundle' =>
                                 array('className' => 'Bundle',
                                                'joinTable'    => 
'bundles_products',
                                                'conditions' => '',
                                                'order' => '',
                                                'foreignKey' => 'product_id',
                                                'associationForeignKey'=> 
'bundle_id',
                                                'uniq'         => true,
                                                'conditions'   => '',
                                                'finderQuery'  => '',
                                                'deleteQuery'  => ''));


Bundle
----------
var $hasAndBelongsToMany = array(
                        'Product' =>
                                 array('className' => 'Product',
                                                'joinTable'    => 
'bundles_products',
                                                'conditions' => '',
                                                'order' => '',
                                                'foreignKey' => 'bundle_id',
                                                'associationForeignKey'=> 
'product_id',
                                                'uniq'         => true,
                                                'conditions'   => '',
                                                'finderQuery'  => '',
                                                'deleteQuery'  => ''),
                        'Campaign' =>
                                 array('className' => 'Campaign',
                                                'joinTable'    => 
'bundles_campaigns',
                                                'conditions' => '',
                                                'order' => '',
                                                'foreignKey' => 'bundle_id',
                                                'associationForeignKey'=> 
'campaign_id',
                                                'uniq'         => true,
                                                'conditions'   => '',
                                                'finderQuery'  => '',
                                                'deleteQuery'  => ''));

I would really appreciate if anyone could help me out.

Cheers,
Trav.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to