mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
Model类的save方法传入更新条件的时候 标识为更新操作
This commit is contained in:
@@ -59,10 +59,10 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
|
||||
// 字段类型或者格式转换
|
||||
protected $type = [];
|
||||
// 当前执行的关联类型
|
||||
private $relation;
|
||||
// 是否为更新数据
|
||||
protected $isUpdate = false;
|
||||
// 当前执行的关联类型
|
||||
private $relation;
|
||||
|
||||
/**
|
||||
* 初始化过的模型.
|
||||
@@ -108,9 +108,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
* @return void
|
||||
*/
|
||||
protected static function init()
|
||||
{
|
||||
|
||||
}
|
||||
{}
|
||||
|
||||
// JsonSerializable
|
||||
public function jsonSerialize()
|
||||
@@ -331,6 +329,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
foreach ($data as $key => $value) {
|
||||
$this->__set($key, $value);
|
||||
}
|
||||
if (!empty($where)) {
|
||||
$this->isUpdate = true;
|
||||
}
|
||||
}
|
||||
// 数据自动验证
|
||||
if (!$this->validateData()) {
|
||||
|
||||
Reference in New Issue
Block a user