Hi, so here's my problem.
table 1: equipment with id_equipment. ex: Notebooks, Printers.
table 2: brand with id_brand. ex: Sony, HP.
There's a many to many relation between these two, so I have another table equipment_brand , with double PRIMARY(id_equipment, id_brand) and foreign keys for the two tables.
Now I have table 3: distributor with id_distributor. ex: 2Net, KLD.
Between the distributor and equipment_brand table, there is also a many to many relation. Which means I have another table 4: distributor_equipment_brand with triple PRIMARY(id_distributor, id_equipment, id_brand) where :
id_distributor foreign to table distributor
(id_equipment, id_brand) double foreign to equipment_brand table
Now, how do I translate this into the relations method of my Distributor model, so that using a downloaded behaviour, the relations are also saved in the triple primary key table.
I would need something like : 'varName' => array(self::MANY_MANY, 'equipment_brand', 'distributor_equipment_brand(id_distributor, array (id_equipment, id_brand))' );
Why ? Cause I have 2 foreign keys, one of which is double, and references another MANY to MANY table.
That, of course, does not work. Any help ? Or does somebody have an example of using composite foreign keys when defining a self::MANY_MANY variable.
Thank you very much.
table 1: equipment with id_equipment. ex: Notebooks, Printers.
table 2: brand with id_brand. ex: Sony, HP.
There's a many to many relation between these two, so I have another table equipment_brand , with double PRIMARY(id_equipment, id_brand) and foreign keys for the two tables.
Now I have table 3: distributor with id_distributor. ex: 2Net, KLD.
Between the distributor and equipment_brand table, there is also a many to many relation. Which means I have another table 4: distributor_equipment_brand with triple PRIMARY(id_distributor, id_equipment, id_brand) where :
id_distributor foreign to table distributor
(id_equipment, id_brand) double foreign to equipment_brand table
Now, how do I translate this into the relations method of my Distributor model, so that using a downloaded behaviour, the relations are also saved in the triple primary key table.
I would need something like : 'varName' => array(self::MANY_MANY, 'equipment_brand', 'distributor_equipment_brand(id_distributor, array (id_equipment, id_brand))' );
Why ? Cause I have 2 foreign keys, one of which is double, and references another MANY to MANY table.
That, of course, does not work. Any help ? Or does somebody have an example of using composite foreign keys when defining a self::MANY_MANY variable.
Thank you very much.