D
D
Denis Popov2018-11-09 11:50:37
Yii
Denis Popov, 2018-11-09 11:50:37

How to implement a link between two tables through two intermediate tables in active record?

Please help to implement the AR link in Yii2... Through one linking table - everything is clear here, but I don’t understand how through 2.
There are 4 tables in total:
R releases (id, title)
A authors (id, name)
TA link_author_track (track_id, author_id)
TR link_release_track (track_id, release_id)
their links:
R.id - TR.release_id
A.id - TA.author_id
TA.track_id - TR.track_id
in the release model I need to get the authors

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question