Exemple #1
0
 public function beforeSave($insert)
 {
     if (empty($this->parent)) {
         $this->parent = 0;
     }
     return parent::beforeSave($insert);
 }
Exemple #2
0
 public function beforeSave($insert)
 {
     parent::beforeSave($insert);
     $this->url_code = \app\common\XUtils::shorturl($this->url);
     $this->description = \app\common\XUtils::ihtmlspecialchars($this->description);
     !$this->id && ($this->createtime = time());
     $this->updatetime = time();
     return true;
 }
 /**
  * This is invoked before the record is saved.
  * @return boolean whether the record should be saved.
  */
 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         if ($this->isNewRecord) {
             $this->create_time = date("Y-m-d H:i:s", time());
             $this->author_id = Yii::$app->user->id;
         }
         return true;
     } else {
         return false;
     }
 }
Exemple #4
0
 /**
  * 入库前自动处理
  */
 public function beforeSave($insert)
 {
     parent::beforeSave($insert);
     if (trim($this->password)) {
         $this->password = md5($this->password);
     }
     if (!$this->id) {
         $this->create_time = time();
         $this->last_login_time = time();
     }
     return true;
 }
Exemple #5
0
 public function beforeSave()
 {
     $this->aBeforeSave();
     $this->tsBeforeSave();
     parent::beforeSave();
 }