In Yii1 I could do something like this:
$posts=Post::model()->with(array(
'comments'=>array(
'scopes'=>array('recently','approved')
),
))->findAll();
Is there a way to call a scope of a relation in the callback function of with() in Yii2?
Customer::find()->with([
'orders' => function ($query) {
$query->andWhere('status = 1');
},
'country',
])->all();