From 1661e68035bf58842dd26e1dcf49c4c4cb32bb53 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 14 Apr 2017 09:03:52 +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 630719c0..9a308d23 100644 --- a/library/think/model/relation/BelongsTo.php +++ b/library/think/model/relation/BelongsTo.php @@ -197,7 +197,7 @@ class BelongsTo extends OneToOne $this->parent->setAttr($foreignKey, $model->$pk); $this->parent->save(); - return $this->parent->data($this->relation, $model); + return $this->parent->setAttr($this->relation, $model); } /** @@ -212,6 +212,6 @@ class BelongsTo extends OneToOne $this->parent->setAttr($foreignKey, null); $this->parent->save(); - return $this->parent->data($this->relation, null); + return $this->parent->setAttr($this->relation, null); } } diff --git a/library/think/model/relation/MorphTo.php b/library/think/model/relation/MorphTo.php index d67989c4..7dc22652 100644 --- a/library/think/model/relation/MorphTo.php +++ b/library/think/model/relation/MorphTo.php @@ -251,7 +251,7 @@ class MorphTo extends Relation $this->parent->setAttr($morphType, get_class($model)); $this->parent->save(); - return $this->parent->data($this->relation, $model); + return $this->parent->setAttr($this->relation, $model); } /** @@ -268,7 +268,7 @@ class MorphTo extends Relation $this->parent->setAttr($morphType, null); $this->parent->save(); - return $this->parent->data($this->relation, null); + return $this->parent->setAttr($this->relation, null); } /**