改进Relation类save方法

This commit is contained in:
thinkphp
2016-09-21 12:15:34 +08:00
parent fcde43a1b0
commit 9abb98d485

View File

@@ -554,7 +554,7 @@ class Relation
case self::BELONGS_TO:
case self::HAS_MANY:
if ($data instanceof Model) {
$data = $data->toArray();
$data = $data->getData();
}
// 保存关联表数据
$data[$this->foreignKey] = $this->parent->{$this->localKey};