I have 3 tables Table1, Table2 and Table3.
I need to connect Table1 and Table2 with ManyToMany relation.
Then I need to connect Table1Table2 table with Table3 with ManyToMany relation.
so I create Table1Table2 table with fields id, table1_id, table2_id
and Table1Table2Table3 table with fields id, table1table2_id, table3_id.
Know I need to fetch Table1 with related Table2 and for each Table2 related Table3.
I try to did it in this way.
Table1 Model
table2s: {
relation: Model.ManyToManyRelation,
modelClass: Table2,
join: {
from: 'table1.id',
through: {
from: 'table1table2.table1_id',
to: 'table1table2.table2_id',
},
to: 'table2.id',
},
},
I can get table1 with related table2s in this way. But I need to get table3s for each table2s, how can I do it? Any help will be appreciated!