views:

103

answers:

0

Hi, is there a way to get or write data to/from joining table in many to many relation?

I have two tables joined by third.

Question one: How can i GET data from the joining(middle) table, when i'm retrieving data in similar query

//table1 is "root" table - containing records related to table3
//table2 is joining/cross table
//table3 containing records related to table1

Doctrine_query::create()
->from('table1 t1')
->innerJoin('t1.table3 t3')
->orderBy('table2.order')

Question two: How can i WRITE to order column in relational data saving.

$table1 = new TableOne();
$table1->some_column = 'some data';
$table1->save();
$table1->link('TableThree', $table1->id)