mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进Model类的map方法
This commit is contained in:
@@ -46,8 +46,6 @@ class Model {
|
|||||||
protected $scope = [];
|
protected $scope = [];
|
||||||
// 字段映射定义
|
// 字段映射定义
|
||||||
protected $map = [];
|
protected $map = [];
|
||||||
// 是否自动检测数据表字段信息
|
|
||||||
protected $autoCheckFields = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 架构函数
|
* 架构函数
|
||||||
@@ -1302,11 +1300,16 @@ class Model {
|
|||||||
/**
|
/**
|
||||||
* 设置字段映射
|
* 设置字段映射
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $map 映射
|
* @param mixed $map 映射名称或者映射数据
|
||||||
|
* @param string $name 映射的字段
|
||||||
* @return Model
|
* @return Model
|
||||||
*/
|
*/
|
||||||
public function map($map){
|
public function map($map,$name=''){
|
||||||
$this->map = $map;
|
if(is_array($map)){
|
||||||
|
$this->map = array_merge($this->map,$map);
|
||||||
|
}else{
|
||||||
|
$this->map[$map] = $name;
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user