本文整理汇总了PHP中DBModel::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP DBModel::validate方法的具体用法?PHP DBModel::validate怎么用?PHP DBModel::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBModel
的用法示例。
在下文中一共展示了DBModel::validate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
protected function validate($for)
{
parent::validate($for);
if ($for == 'insert' && self::get($this->language))
{
$this->language_error = t('%n is used');
throw new ValidationException($this);
}
}
示例2: validate
protected function validate($for)
{
parent::validate($for);
if (self::get($this->userID, $this->groupID))
{
throw new Exception(t('User is already member of group'));
}
}
示例3: validate
protected function validate($for)
{
parent::validate($for);
if ($for == 'insert')
{
if (self::get($this->name))
{
$this->name_error = t('Name already exists');
throw new ValidationException($this);
}
}
else if ($for == 'update')
{
if ($this->name_changed && self::get($this->name))
{
$this->name_error = t('Name already exists');
throw new ValidationException($this);
}
}
}
示例4: validate
protected function validate($for)
{
parent::validate($for);
if ($for == 'insert')
{
$error = false;
if ($this->usernameExists($this->username))
{
$this->username_error = t('%n is already taken');
$error = true;
}
if ($this->emailExists($this->email))
{
$this->email_error = t('%n is already taken');
$error = true;
}
if ($this->password != $this->passwordConfirmation)
{
$this->passwordConfirmation_error = t('Passwords are not equal');
$error = true;
}
if ($error)
{
throw new ValidationException($this);
}
}
else if ($for == 'update')
{
$error = false;
if ($this->username_changed &&
$this->usernameExists($this->username))
{
$this->username_error = t('%n is already taken');
$error = true;
}
if ($this->email_changed &&
$this->emailExists($this->email))
{
$this->email_error = t('%n is already taken');
$error = true;
}
if ($this->password != null && !$this->forceNewPassword)
{
$this->validate('updatePassword');
}
else if ($this->password != null)
{
$this->validate('forceNewPassword');
}
if ($error)
{
throw new ValidationException($this);
}
}
else if ($for == 'updatePassword' || $for == 'forceNewPassword')
{
if ($for == 'updatePassword')
{
if (!$this->checkPassword($this->oldPassword))
{
$this->oldPassword_error = t('Password is wrong');
throw new ValidationException($this);
}
}
if ($this->password != $this->passwordConfirmation)
{
$this->passwordConfirmation_error = t('Passwords do not match');
throw new ValidationException($this);
}
}
}
示例5: validate
protected function validate($for)
{
parent::validate($for);
if ($for == 'insert' && $this->parentID != '')
{
if (self::translatedInWithParams($this->parentID, $this->datePosted_db, $this->language))
{
$this->text_error = t('This blog is already translated in this language');
throw new ValidationException($this);
}
}
}
示例6: doSomethingSpecialWhichTriggersConditionalValidation
public function doSomethingSpecialWhichTriggersConditionalValidation()
{
parent::validate('special');
}
示例7: validate
protected function validate($for)
{
parent::validate($for);
if ($for == 'insert')
{
if ($this->originalLanguage)
{
$original = Page::get($this->originalID, $this->originalLanguage);
if ($original->hasTranslation($this->language))
{
$this->title_error = t('This page is already translated');
throw new ValidationException($this);
}
}
}
}