Yii2 join with active record
<pre><code>$slider = Slider::find() 
    -&gt;joinWith([
        'slides' =&gt; function (ActiveQuery $query) {
            $query-&gt;addOrderBy(sprintf('%s.position', Slide::tableName()));
        }
    ], false)
    -&gt;one();
/* OK */
SELECT "sliders".* 
FROM "sliders" 
LEFT JOIN "slider_slides" 
ON "sliders"."id" = "slider_slides"."slider_id" 
ORDER BY "slider_slides"."position"
</code></pre>

<p>The problem is that when I accees to relation <code>$slider-&gt;slides</code> debugger shows me additional query:</p>

<pre><code>SELECT * FROM "slider_slides" WHERE "slider_id"=1
</code></pre>

<p>which does join useless.</p>