當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DBModel::validate方法代碼示例

本文整理匯總了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);
		}
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:9,代碼來源:language.model.php

示例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'));
		}
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:9,代碼來源:usergroupmember.model.php

示例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);
			}
		}
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:20,代碼來源:menu.model.php

示例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);
			}
		}
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:74,代碼來源:user.model.php

示例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);
			}
		}
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:13,代碼來源:blog.model.php

示例6: doSomethingSpecialWhichTriggersConditionalValidation

	public function doSomethingSpecialWhichTriggersConditionalValidation()
	{
		parent::validate('special');
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:4,代碼來源:model.Test.php

示例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);
				}
			}
		}
	}
開發者ID:nathansamson,項目名稱:CoOrg,代碼行數:16,代碼來源:page.model.php


注:本文中的DBModel::validate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。