Example #1
0
 /**
  * 存储前设置ID,因为这里要重用被删除的ID
  * @see CActiveRecord::beforeSave()
  */
 public function beforeSave()
 {
     if (parent::beforeSave()) {
         if ($this->isNewRecord) {
             //如果是添加记录,而且Options表存在上次被删除的用户ID,则重复使用
             $currentId = MiniUserDevice::getInstance()->getTemporaryId();
             if (!empty($currentId)) {
                 $this->id = $currentId;
             }
         }
         return true;
     }
     return false;
 }
Example #2
0
 /**
  * Returns the static model of the specified AR class.
  * return User the static model class
  */
 public static function model($className = __CLASS__)
 {
     return parent::model($className);
 }
Example #3
0
 /**
  * 存储前的时间补全, 密码加密
  * @see CActiveRecord::beforeSave()
  */
 public function beforeSave()
 {
     parent::beforeSave();
     $this->file_name_pinyin = MiniUtil::getPinYinByName($this->file_name);
     return true;
 }
Example #4
0
 public function getDbConnection()
 {
     self::$db = Yii::app()->getComponent('db');
     return self::$db;
 }