From cffb772743a94d803dd3223189f39acdb878f4fb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 18 Jan 2017 13:58:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/relation/OneToOne.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/think/model/relation/OneToOne.php b/library/think/model/relation/OneToOne.php index 69f57072..0ff739cc 100644 --- a/library/think/model/relation/OneToOne.php +++ b/library/think/model/relation/OneToOne.php @@ -267,9 +267,8 @@ 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'); + if ($field = $model->getOptions('with_field')) { + $model->field($field)->removeOption('with_field'); } } $list = $model->where($where)->with($subRelation)->select();