From e9d45eb570c2222fc35fcb0e6731b4c150c0357c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 27 Apr 2017 11:18:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BModel=E7=B1=BB=E7=9A=84setAtt?= =?UTF-8?q?r=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 12948b6e..1310cf0f 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -343,14 +343,15 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $method = 'set' . Loader::parseName($name, 1) . 'Attr'; if (method_exists($this, $method)) { $value = $this->$method($value, array_merge($this->data, $data)); - } - if ($this->isRelationAttr($name)) { - $isRelationData = true; } elseif (isset($this->type[$name])) { // 类型转换 $value = $this->writeTransform($value, $this->type[$name]); } + if ($this->isRelationAttr($name)) { + $isRelationData = true; + } + } // 设置数据对象属性