首页›模型层›AttributeModel
AttributeModel
Kuoqi\Model\Model\AttributeModel:属性值容器(输入/输出过滤器 + 变更追踪)
方法清单
| 方法 | 签名 | 说明 |
|---|---|---|
__construct | ($name) | 创建属性容器 |
getName | getName() | 字段名 |
setValue | setValue($value,$withFilter=true) | 先过 FilterInputModel 输入过滤,值变化才置 isChanged |
initValue | initValue($value) | 数据库回填,不置 changed |
getValue | getValue($withFilter=true) | 默认过 FilterOutputModel 输出过滤 |
setFilter | setFilter($filter) | 由 Model 构造时从 fields[verify] 注入 |
isChanged | isChanged() | 是否有变更 |
initChanged | initChanged($status) | 重置变更标记 |
工作流程
// Model 构造时为每个 attributes 创建 AttributeModel
// 数据库回填(不标记变更)
$attr->initValue($row["title"]);
// 用户赋值(输入过滤 + 变更追踪)
$attr->setValue("新标题"); // 变化 → isChanged=true
// 读取(输出过滤:如时间戳→日期)
echo $attr->getValue();
KuoqiPHP v1.05 · 离线静态文档 · 界面基于 KuoqiUI ·
返回首页