thinkphp源码无差别阅读(三十二)

ORM阅读

model/concorn/SoftDelete.php

  • 属性:withTrashed
  • 判断当前实例是否被软删除:trashed
  • 查询软删除数据:withTrashed
  • 是否包含软删除数据:withTrashedData
  • 只查询软删除数据:onlyTrashed
  • 获取软删除的查询条件:getWithTrashedExp
  • 删除:delete
  • 删除:destroy
  • 恢复:restore
  • 获取软删除字段:getDeleteTimeField
  • 排除软删除数据:withNoTrashed

model/concern/TimeStamp.php

  • 属性:autoWriteTimeStamp、createTime、updateTime、dateFormat
  • 是否自动写入时间戳:isAutoWriteTimestamp
  • 检测时间字段类型:checkTimeFieldType
  • 设置时间字段名称:setTimeField
  • 获取自动写入的时间字段:getAutoWriteTimestamp
  • 设置时间字段格式化:setDataFormat
  • 获取自动写入时间字段:getDateFormat
  • 自动写入时间戳:autoWriteTimestamp
  • 获取自动类型的时间字段值:getTimeTypeValue
  • 时间日期格式化:formatDateTime
  • 获取时间字段值:getTimestampValue

model/concern/Virtual.php

  • 获取查询对象:db
  • 获取字段类型信息:getFieldType
  • 保存数据:save
  • 删除当前记录:delete

model/concern/BelongsTo.php

  • 构造方法:__construct
  • 延迟获取关联数据:getRelation
  • 创建关联统计子查询:getRelationCountQuery
  • 关联统计:relationCount
  • 根据关联条件查询关联模型:has
  • 根据关联条件查询关联模型:hasWhere
  • 预载于关联查询:eagerlySet
  • 预载于关联查询:eagerlyOne
  • 添加关联数据:associate
  • 注销关联数据:dissociate
  • 执行基础查询:baseQuery

计划阅读

[ ] framework源码
[ ] orm源码
[ ] helper源码

03-05 23:26