標籤彙整: yii

Yii ActiveRecord空字串存成Null

因為搞了快1個小時
搞定後~~筆記下來…

直接下Models 裡面的 rules()
設定

public function rules()
{
  array('column1,column2', 'default', 'setOnEmpty' => true, 'value' => null),
}

ref. http://www.yiiframework.com/forum/index.php?/topic/5448-blank-fields-in-forms-insert-replace-default-null-columns-with-empty-string/