一对一预载入 In查询方式兼容withField方法

This commit is contained in:
thinkphp
2017-01-18 13:56:41 +08:00
parent 4c2665b9f9
commit 4a7e4d5d28

View File

@@ -267,6 +267,10 @@ abstract class OneToOne extends Relation
// 预载入关联查询 支持嵌套预载入
if ($closure) {
call_user_func_array($closure, [ & $model]);
if ($model->getOptions('with_field')) {
$model->field($model->getOptions('with_field'));
$model->removeOption('with_field');
}
}
$list = $model->where($where)->with($subRelation)->select();