完善Model的自动关联更新

This commit is contained in:
thinkphp
2017-01-19 14:18:26 +08:00
parent 55bcfca1bd
commit ecd0ff3536

View File

@@ -831,6 +831,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
if ($val instanceof Model) {
$val->save();
} else {
unset($this->data[$name]);
$model = $this->getAttr($name);
if ($model instanceof Model) {
$model->save($val);