Yii2: Relation through multiple via
<p>I have a relation through multiple intermediate tables. How can I define in Yii2?</p>

<p>So for I have tried following</p>

<pre><code>public function getTbl1()
{
    return $this-&gt;hasOne( Tbl1::className(), [ 'id' =&gt; 'tbl1_id' ] );
}

public function getTbl2()
{
    return $this-&gt;hasOne( Tbl2::className(), [ 'id' =&gt; 'tbl2_id' ] )-&gt;via( 'tbl1' );
}

public function getTbl3()
{
    return $this-&gt;hasOne( Tbl3::className(), [ 'id' =&gt; 'tbl3_id' ] )-&gt;via( 'tbl2' );
}
</code></pre>

<p>I get the relation tbl1 and tbl2, but not able to get the tbl3. How can I do it?</p>

<p>Thanks in advance.</p>