mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进Model 注释修改
This commit is contained in:
@@ -32,12 +32,6 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
// 回调事件
|
// 回调事件
|
||||||
protected static $event = [];
|
protected static $event = [];
|
||||||
|
|
||||||
// 数据信息
|
|
||||||
protected $data = [];
|
|
||||||
// 缓存数据
|
|
||||||
protected $cache = [];
|
|
||||||
// 记录改变字段
|
|
||||||
protected $change = [];
|
|
||||||
// 数据表主键 复合主键使用数组定义
|
// 数据表主键 复合主键使用数组定义
|
||||||
protected $pk = 'id';
|
protected $pk = 'id';
|
||||||
// 错误信息
|
// 错误信息
|
||||||
@@ -46,17 +40,23 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
protected $name;
|
protected $name;
|
||||||
// 字段验证规则
|
// 字段验证规则
|
||||||
protected $validate;
|
protected $validate;
|
||||||
// 字段完成规则
|
|
||||||
protected $auto = [];
|
|
||||||
|
|
||||||
|
// 数据信息
|
||||||
|
protected $data = [];
|
||||||
|
// 缓存数据
|
||||||
|
protected $cache = [];
|
||||||
|
// 记录改变字段
|
||||||
|
protected $change = [];
|
||||||
|
|
||||||
|
// 保存自动完成列表
|
||||||
|
protected $auto = [];
|
||||||
|
// 新增自动完成列表
|
||||||
|
protected $insert = [];
|
||||||
|
// 更新自动完成列表
|
||||||
|
protected $update = [];
|
||||||
// 时间戳字段列表
|
// 时间戳字段列表
|
||||||
protected $timestampField = ['create_time', 'update_time'];
|
protected $timestampField = ['create_time', 'update_time'];
|
||||||
|
|
||||||
// 新增要自动完成的字段列表
|
|
||||||
protected $insert = [];
|
|
||||||
// 更新要自动完成的字段列表
|
|
||||||
protected $update = [];
|
|
||||||
|
|
||||||
// 字段类型或者格式转换
|
// 字段类型或者格式转换
|
||||||
protected $type = [];
|
protected $type = [];
|
||||||
// 当前执行的关联类型
|
// 当前执行的关联类型
|
||||||
@@ -305,7 +305,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 数据自动验证
|
// 数据自动验证
|
||||||
if (!$this->validateData($this->data)) {
|
if (!$this->validateData()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (false === $this->trigger('before_write', $this)) {
|
if (false === $this->trigger('before_write', $this)) {
|
||||||
@@ -393,7 +393,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
* 是否为更新数据
|
* 是否为更新数据
|
||||||
* @access public
|
* @access public
|
||||||
* @param bool|null $update
|
* @param bool|null $update
|
||||||
* @return void
|
* @return bool|Model
|
||||||
*/
|
*/
|
||||||
protected function isUpdate($update = null)
|
protected function isUpdate($update = null)
|
||||||
{
|
{
|
||||||
@@ -475,9 +475,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据自动验证
|
* 自动验证当前数据对象值
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $data 数据
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function validateData()
|
public function validateData()
|
||||||
|
|||||||
Reference in New Issue
Block a user