From e0005ea5ad12048400f9c2ec5e2982e02560ebda Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 4 Jun 2016 10:07:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=A8=A1=E5=9E=8B(Model)?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E8=8E=B7=E5=8F=96=E5=80=BC=E6=97=B6=E4=B8=8E?= =?UTF-8?q?Model=E7=B1=BB=E7=9A=84=E6=96=B9=E6=B3=95=E5=86=B2=E7=AA=81BUG?= =?UTF-8?q?=20fix=20#105?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 97e614e0..77d4a3bf 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -292,11 +292,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 检测属性获取器 $method = 'get' . Loader::parseName($name, 1) . 'Attr'; if (method_exists($this, $method)) { - return $this->$method($value, $this->data); + $value = $this->$method($value, $this->data); } elseif (!is_null($value) && isset($this->type[$name])) { // 类型转换 $value = $this->readTransform($value, $this->type[$name]); - } elseif (is_null($value) && method_exists($this, $name)) { + } elseif (is_null($value) && !isset($this->fieldType[$name]) && method_exists($this, $name)) { // 获取关联数据 $value = $this->relation()->getRelation($name); // 保存关联对象值