PHP 클래스 think\model\Merge

상속: extends think\Model
파일 보기 프로젝트 열기: top-think/framework

보호된 프로퍼티들

프로퍼티 타입 설명
$fk HAS ONE 关联的模型列表
$mapFields 外键名 默认为主表名_id
$relationModel

공개 메소드들

메소드 설명
__construct ( array | object $data = [] ) 架构函数
all ( mixed $data = null, string $with = [], $cache = false ) : array | false | string 查找所有记录
delete ( ) : integer 删除当前的记录 并删除关联数据
get ( mixed $data = null, string $with = [], boolean $cache = false ) : Model 查找单条记录
save ( mixed $data = [], array $where = [], string $sequence = null ) : integer | false 保存模型数据 以及关联数据

보호된 메소드들

메소드 설명
attachQuery ( Query $query ) : Query 附加查询表达式
getModelField ( Query $query, string $name, string $table = '', array $map = [] ) : array 获取关联模型的字段 并解决混淆
parseData ( string $model, array $data, boolean $insert = false ) : void 处理写入的模型数据

메소드 상세

__construct() 공개 메소드

架构函数
public __construct ( array | object $data = [] )
$data array | object 数据

all() 공개 정적인 메소드

查找所有记录
public static all ( mixed $data = null, string $with = [], $cache = false ) : array | false | string
$data mixed 主键列表或者查询条件(闭包)
$with string 关联预查询
리턴 array | false | string

attachQuery() 보호된 정적인 메소드

附加查询表达式
protected static attachQuery ( Query $query ) : Query
$query Think\Db\Query 查询对象
리턴 Think\Db\Query

delete() 공개 메소드

删除当前的记录 并删除关联数据
public delete ( ) : integer
리턴 integer

get() 공개 정적인 메소드

查找单条记录
public static get ( mixed $data = null, string $with = [], boolean $cache = false ) : Model
$data mixed 主键值或者查询条件(闭包)
$with string 关联预查询
$cache boolean 是否缓存
리턴 think\Model

getModelField() 보호된 정적인 메소드

获取关联模型的字段 并解决混淆
protected static getModelField ( Query $query, string $name, string $table = '', array $map = [] ) : array
$query Think\Db\Query 查询对象
$name string 模型名称
$table string 关联表名称
$map array 字段映射
리턴 array

parseData() 보호된 메소드

处理写入的模型数据
protected parseData ( string $model, array $data, boolean $insert = false ) : void
$model string 模型名称
$data array 数据
$insert boolean 是否新增
리턴 void

save() 공개 메소드

保存模型数据 以及关联数据
public save ( mixed $data = [], array $where = [], string $sequence = null ) : integer | false
$data mixed 数据
$where array 更新条件
$sequence string 自增序列名
리턴 integer | false

프로퍼티 상세

$fk 보호되어 있는 프로퍼티

HAS ONE 关联的模型列表
protected $fk

$mapFields 보호되어 있는 프로퍼티

外键名 默认为主表名_id
protected $mapFields

$relationModel 보호되어 있는 프로퍼티

protected $relationModel