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