时间模型类TimestampBehavior
来源:互联网 发布:古生物学与地层学知乎 编辑:程序博客网 时间:2024/06/08 17:21
概念概况
当模型发生变动时,自动给模型赋值时间
用法:
在模型类里加上以下方法即可
use yii\behaviors\TimestampBehavior;use yii\db\ActiveRecord;class CarSuit extends ActiveRecord{ public function behaviors() { return [ [ 'class' => TimestampBehavior::className(), 'createdAtAttribute' => 'createtime', 'updatedAtAttribute' => 'updatetime', 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['createtime', 'updatetime'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updatetime'], ] ] ]; } ... }
以上当CarSuit这个类模型发生变动,createtime
和updatetime
也会变化.
就这么简单…
阅读全文
0 0
- 时间模型类TimestampBehavior
- [Yii2.0 TimestampBehavior]
- Yii2 TimestampBehavior行为
- oracle时间模型
- 时间序列预测模型
- oracle 时间模型
- oracle时间模型
- oracle时间模型概念
- AWR中的时间模型
- 时间序列模型
- 时间鉴权模型
- CALayer以及时间模型
- 时间序列模型预测
- 时间序列回归模型
- CALayer 以及时间模型
- 时间序列模型
- CALayer及时间模型
- CALayer 以及时间模型
- Machine Learning---5--SVM
- Android 常用正则表达式
- 深入浅出Synchronized
- 自定义注释几个参数说明
- 微信小程序 录音文件格式silk 坑
- 时间模型类TimestampBehavior
- 【转】采购订单长文本增强
- Android 头像修改
- 1089: 杨辉三角
- 有用的性能指标
- java
- 1090: 螺旋方阵
- transform基本转换应用2D
- 数据结构-栈