From 721142f8852c2bcd0ccc53d166342ea24a7ac98c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 28 Mar 2017 19:17:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/relation/BelongsTo.php | 4 ++-- library/think/model/relation/MorphTo.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/think/model/relation/BelongsTo.php b/library/think/model/relation/BelongsTo.php index cdfa5da6..4c8b7926 100644 --- a/library/think/model/relation/BelongsTo.php +++ b/library/think/model/relation/BelongsTo.php @@ -184,7 +184,7 @@ class BelongsTo extends OneToOne $this->parent->setAttr($foreignKey, $model->$pk); $this->parent->save(); - return $this->parent->setAttr($this->relation, $model); + return $this->parent->data($this->relation, $model); } /** @@ -199,6 +199,6 @@ class BelongsTo extends OneToOne $this->parent->setAttr($foreignKey, null); $this->parent->save(); - return $this->parent->setAttr($this->relation, null); + return $this->parent->data($this->relation, null); } } diff --git a/library/think/model/relation/MorphTo.php b/library/think/model/relation/MorphTo.php index 9c97500c..9c020b85 100644 --- a/library/think/model/relation/MorphTo.php +++ b/library/think/model/relation/MorphTo.php @@ -241,7 +241,7 @@ class MorphTo extends Relation $this->parent->setAttr($morphType, get_class($model)); $this->parent->save(); - return $this->parent->setAttr($this->relation, $model); + return $this->parent->data($this->relation, $model); } /** @@ -258,7 +258,7 @@ class MorphTo extends Relation $this->parent->setAttr($morphType, null); $this->parent->save(); - return $this->parent->setAttr($this->relation, null); + return $this->parent->data($this->relation, null); } /**