How to handle many to many relations with some extra fields other that primary key

Hi,

I have a many to many bridge table which contains some extra fields other the the pks of the two parent tables. How can I update this table using AR records?

My table structure has the following columns,

  1. categoryid (fk from category table)

  2. productid (fk from product table)

  3. otherfield1

  4. otherfield2

As this is a many to many bridge table, categoryid and productid are the composite primary key. Otherfields* are some extra information i need to store.

Is there any way I can handle this with AR records? or any extensions?

Thanks in advance.

Regards,

Solution is to create a model for this bridge table and use it.

can you please give an idea how to do this? Thanks you for all your help.

http://www.yiiframework.com/doc/guide/1.1/en/topics.gii

Thanks for your solution, but before to implement I see a problem.

What does it happen, if we want to create a object, from a unique "create view", with information of two models (model parent and model joined).

How do we do to call the render with only one model?




<?php

$this->renderPartial('_form_create', array(

		'model' => $model,

		'buttons' => 'create'));

?>

There is only the possibility of creating a shared model?