改进关联

This commit is contained in:
thinkphp
2017-04-14 09:03:52 +08:00
parent 7841563bd0
commit 1661e68035
2 changed files with 4 additions and 4 deletions

View File

@@ -197,7 +197,7 @@ class BelongsTo extends OneToOne
$this->parent->setAttr($foreignKey, $model->$pk); $this->parent->setAttr($foreignKey, $model->$pk);
$this->parent->save(); $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->setAttr($foreignKey, null);
$this->parent->save(); $this->parent->save();
return $this->parent->data($this->relation, null); return $this->parent->setAttr($this->relation, null);
} }
} }

View File

@@ -251,7 +251,7 @@ class MorphTo extends Relation
$this->parent->setAttr($morphType, get_class($model)); $this->parent->setAttr($morphType, get_class($model));
$this->parent->save(); $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->setAttr($morphType, null);
$this->parent->save(); $this->parent->save();
return $this->parent->data($this->relation, null); return $this->parent->setAttr($this->relation, null);
} }
/** /**