protected function afterValidate() { //check product permission if (!self::isProductAccessable($this->product_id)) { $this->addError('product_id', $this->getAttributeLabel('product_id') . ' ' . Yii::t('Product', 'No access right to this product')); } //set modified_by if ($this->isNewRecord) { $this->modified_by = $this->updated_by; } else { $dbBugInfo = $this->model()->findByPk($this->id); $oldModifiedBy = $dbBugInfo->modified_by; if (!in_array($this->updated_by, CommonService::splitStringToArray(',', $oldModifiedBy))) { if (empty($this->modified_by)) { $this->modified_by = $this->updated_by; } else { $this->modified_by .= ',' . $this->updated_by; } } } //set productmodule_id to be null if productmodule_id = 0 if (0 == $this->productmodule_id) { $this->productmodule_id = null; } //filter duplicated mail_to if (!empty($this->mail_to)) { $this->mail_to = join(',', CommonService::splitStringToArray(',', $this->mail_to)); } //set assign_to if (!empty($this->assign_to_name)) { if (TestUser::ACTIVE_USER_NAME == $this->assign_to_name) { $this->assign_to = TestUser::ACTIVE_USER_ID; } else { if (TestUser::CLOSE_USER_NAME == $this->assign_to_name) { $this->assign_to = TestUser::CLOSE_USER_ID; } else { $assigntoInfo = TestUser::model()->findByAttributes(array('realname' => $this->assign_to_name)); if ($assigntoInfo !== null) { $this->assign_to = $assigntoInfo->id; } else { $assigntoNameError = $this->getError('assign_to_name'); if (empty($assigntoNameError)) { $this->addError('assign_to_name', $this->getAttributeLabel('assign_to_name') . ' ' . Yii::t('TestUser', 'user not found')); } } } } } else { $this->assign_to = null; } return parent::afterValidate(); }
protected function afterValidate() { if (!empty($this->editable_action_name)) { $this->editable_action = join(',', $this->editable_action_name); } return parent::afterValidate(); }
/** * Returns the static model of the specified AR class. * @return TestOption the static model class */ public static function model($className = __CLASS__) { return parent::model($className); }
protected function beforeValidate() { $this->email = trim($this->email); $this->wangwang = trim($this->wangwang); return parent::beforeValidate(); }