本文整理汇总了PHP中Info::beforeValidate方法的典型用法代码示例。如果您正苦于以下问题:PHP Info::beforeValidate方法的具体用法?PHP Info::beforeValidate怎么用?PHP Info::beforeValidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Info
的用法示例。
在下文中一共展示了Info::beforeValidate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeValidate
protected function beforeValidate()
{
if ($this->isNewRecord) {
$this->delete_flag = CommonService::$TrueFalseStatus['FALSE'];
}
return parent::beforeValidate();
}
示例2: beforeValidate
protected function beforeValidate()
{
if ($this->isNewRecord) {
if (empty($this->related_case_id)) {
$this->addError('related_case_id', Yii::t('ResultInfo', 'related_case_id can not be blank'));
} else {
$caseModel = CaseInfo::model()->findByPk($this->related_case_id);
if ($caseModel == null) {
$this->addError('related_case_id', Yii::t('Common', 'Requested object does not exist'));
} else {
$this->title = $caseModel->title;
$this->product_id = $caseModel->product_id;
$this->productmodule_id = $caseModel->productmodule_id;
}
}
}
return parent::beforeValidate();
}
示例3: beforeValidate
protected function beforeValidate()
{
if (!$this->isNewRecord) {
if (BugInfo::ACTION_RESOLVE == $this->scenario) {
$this->resolved_at = date(CommonService::DATE_FORMAT);
$this->resolved_by = Yii::app()->user->id;
} elseif (BugInfo::ACTION_CLOSE == $this->scenario) {
$this->closed_at = date(CommonService::DATE_FORMAT);
$this->closed_by = Yii::app()->user->id;
} elseif (BugInfo::ACTION_ACTIVATE == $this->scenario) {
$this->resolved_at = null;
$this->resolved_by = null;
$this->closed_at = null;
$this->closed_by = null;
$this->solution = null;
$this->duplicate_id = null;
}
}
return parent::beforeValidate();
}