From a4646ba1a9b810b41a7887d01524be3dfc680b0c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 28 Mar 2017 12:47:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4Model=E7=B1=BBsetAttr?= =?UTF-8?q?=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 | 2 +- library/think/model/relation/BelongsTo.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index f5c8b9c8..f4457361 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -283,7 +283,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess // 检测修改器 $method = 'set' . Loader::parseName($name, 1) . 'Attr'; if (method_exists($this, $method)) { - $value = $this->$method($value, array_merge($data, $this->data)); + $value = $this->$method($value, $data); } elseif (isset($this->type[$name])) { // 类型转换 $value = $this->writeTransform($value, $this->type[$name]); diff --git a/library/think/model/relation/BelongsTo.php b/library/think/model/relation/BelongsTo.php index 327939d8..cdfa5da6 100644 --- a/library/think/model/relation/BelongsTo.php +++ b/library/think/model/relation/BelongsTo.php @@ -24,6 +24,7 @@ class BelongsTo extends OneToOne * @param string $foreignKey 关联外键 * @param string $localKey 关联主键 * @param string $joinType JOIN类型 + * @param string $relation 关联名 */ public function __construct(Model $parent, $model, $foreignKey, $localKey, $joinType = 'INNER', $relation = null) {