I have a relation through multiple intermediate tables. How can I define in Yii2?
So for I have tried following
public function getTbl1() { return $this->hasOne( Tbl1::className(), [ 'id' => 'tbl1_id' ] ); } public function getTbl2() { return $this->hasOne( Tbl2::className(), [ 'id' => 'tbl2_id' ] )->via( 'tbl1' ); } public function getTbl3() { return $this->hasOne( Tbl3::className(), [ 'id' => 'tbl3_id' ] )->via( 'tbl2' ); } I get the relation tbl1 and tbl2, but not able to get the tbl3. How can I do it?
Thanks in advance.