在Yii1中我可以这样做:$posts=Post::model()->with(array('comments'=>array('scopes'=>array('recently','approved')),))->findAll();有没有办法在Yii2的with()回调函数中调用关系的范围?Customer::find()->with(['orders'=>function($query){$query->andWhere('status=1');},'country',])->all(); 最佳答案 一个干净的解决方案是覆盖模