调整关联模型的save方法返回值

This commit is contained in:
thinkphp
2017-03-10 14:36:17 +08:00
parent d086406a54
commit fdd6558d69
4 changed files with 10 additions and 10 deletions

View File

@@ -215,7 +215,7 @@ class MorphMany extends Relation
* 保存(新增)当前关联数据对象
* @access public
* @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键
* @return integer
* @return Model|false
*/
public function save($data)
{
@@ -225,10 +225,10 @@ class MorphMany extends Relation
// 保存关联表数据
$pk = $this->parent->getPk();
$model = new $this->model;
$data[$this->morphKey] = $this->parent->$pk;
$data[$this->morphType] = $this->type;
$model = new $this->model;
return $model->save($data);
return $model->save($data) ? $model : false;
}
/**