Many To Many Relationship With More Than 2 Foreign Key Fields On Bridge Table.

Hi Guys!

Well… I’d like to know how I can do a relationship many to many when I have the following situation:

TABLES:

  • responsible: id, name, …

  • child: id, name, …

  • kinship: id, description, …

  • child_responsible: child_id, responsible_id, kinship_id

if it was just (child_responsible: child_id, responsible_id) the relationship would be like this:

Child model:


'responsibles' => array(self::MANY_MANY, 'Responsible', 'child_responsible(child_id, responsible_id)')



But in this case my table child_responsible has 3 fields.

How do I write my relationship?

I also wanna know a nice way to retrieve those data and save them from a webform.

Thank you very much.

Up!