修正isUpdate方法

This commit is contained in:
thinkphp
2016-04-08 16:23:08 +08:00
parent 13142d6a6b
commit 5af38b9bd0

View File

@@ -363,8 +363,6 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
} }
$result = $db->update($this->data); $result = $db->update($this->data);
// 清空change
$this->change = [];
// 更新回调 // 更新回调
$this->trigger('after_update', $this); $this->trigger('after_update', $this);
} else { } else {
@@ -393,6 +391,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
// 标记为更新 // 标记为更新
$this->isUpdate = true; $this->isUpdate = true;
// 清空change
$this->change = [];
return $result; return $result;
} }
@@ -402,7 +402,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
* @param bool $update * @param bool $update
* @return Model * @return Model
*/ */
protected function isUpdate($update = true) public function isUpdate($update = true)
{ {
$this->isUpdate = $update; $this->isUpdate = $update;
return $this; return $this;