当前位置: 首页>>代码示例>>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;未经允许,请勿转载。