From 6d3b6bf9fc8bc88cb018ebe4d9f752127e80d7cb Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 28 Sep 2016 21:04:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=B8=80=E5=AF=B9=E4=B8=80?= =?UTF-8?q?=E9=A2=84=E8=BD=BD=E5=85=A5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/Relation.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/library/think/model/Relation.php b/library/think/model/Relation.php index 69b80270..22670bdd 100644 --- a/library/think/model/Relation.php +++ b/library/think/model/Relation.php @@ -318,11 +318,7 @@ class Relation } } - if (!isset($list[$relation])) { - // 设置关联模型属性 - $list[$relation] = []; - } - $result->setAttr($relation, (new $model($list[$relation]))->isUpdate(true)); + $result->setAttr($relation, !isset($list[$relation]) ? null : (new $model($list[$relation]))->isUpdate(true)); } /**