mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 15:42:48 +08:00
优化
This commit is contained in:
@@ -126,15 +126,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
/**
|
/**
|
||||||
* 转换为数组
|
* 转换为数组
|
||||||
* @access public
|
* @access public
|
||||||
* @return Model
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray()
|
public function toArray()
|
||||||
{
|
{
|
||||||
if (!empty($this->data)) {
|
return !empty($this->data) ? $this->data : [];
|
||||||
return $this->data;
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,12 +175,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 标记字段更改
|
// 标记字段更改
|
||||||
if (!isset($this->data[$name]) || (isset($this->data[$name]) && $this->data[$name] != $value && !in_array($name, $this->change))) {
|
if (!isset($this->data[$name]) || ($this->data[$name] != $value && !in_array($name, $this->change))) {
|
||||||
$this->change[] = $name;
|
$this->change[] = $name;
|
||||||
}
|
}
|
||||||
// 设置数据对象属性
|
// 设置数据对象属性
|
||||||
$this->data[$name] = $value;
|
$this->data[$name] = $value;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user