本文整理匯總了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);
}
}
}
}