[['rId','advertiser_id','image_file'], 'unique','targetAttribute'=>['rId','advertiser_id','image_file'],'message'=>'重复插入数据'],//设置多个字段唯一

  

public static function getTableSchema()  //设置字段的可变属性
{
$schema = parent::getTableSchema();
$schema->columns['age']->phpType = 'string';
return $schema;
}

  

 public function behaviors()
{
return !empty($this->getDirtyAttributes())?[ //设置脏字段时最后更新时间变动
'timestamp' => [
'class' => TimestampBehavior::className(),
'attributes' => [
ActiveRecord::EVENT_BEFORE_INSERT => ['created_time', 'last_modified_time'],
ActiveRecord::EVENT_BEFORE_UPDATE => 'last_modified_time',
],
'value' => function() { return date('Y-m-d H:i:s'); },
],
]:(parent::behaviors());
}

  

最新文章

  1. 基于STSdb和fastJson的磁盘/内存缓存
  2. IOS-KVO&KVC
  3. POJ 3180-The Cow Prom (图论-有向图强联通tarjan算法)
  4. MySQL数据库学习笔记(五)----MySQL字符串函数、日期时间函数
  5. cocos2d-x 制作系统公告
  6. cocos2dx游戏开发——微信打飞机学习笔记(十一)——GameOverScene的搭建
  7. poj3449Geometric Shapes
  8. CSS之弧形阴影
  9. threading模块
  10. excel取值
  11. hexo 适合前端 geek 的博客
  12. Harry Potter and the Prisoner of Azkaban
  13. C# 让程序自动以管理员身份运行
  14. Windows下安装Redmine-2.5.3
  15. java中强,软,弱,虚引用 以及WeakHahMap
  16. hdu 5445 多重背包
  17. JDK AtomicInteger 源码分析
  18. python第九十天----jquery
  19. QPS/TPS/并发量/系统吞吐量的概念
  20. StringBuffer类和String类(原文地址 : http://www.cnblogs.com/springcsc/archive/2009/12/03/1616330.html)

热门文章

  1. Nginx分片限流
  2. 『忘了再学』Shell基础 — 19、使用declare命令声明变量类型
  3. ZJOI2020
  4. 多态——JavaSE基础
  5. AR Engine运动跟踪能力,高精度实现沉浸式AR体验
  6. VS Code官方插件集与工具
  7. HashMap高阶用法,十倍提升开发效率
  8. layui 数据表格 数据更新完成后数据刷新
  9. 8.shell编程之免交互
  10. 理论+案例,带你掌握Angular依赖注入模式的应用