本文整理汇总了PHP中CFormModel::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormModel::validate方法的具体用法?PHP CFormModel::validate怎么用?PHP CFormModel::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormModel
的用法示例。
在下文中一共展示了CFormModel::validate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
public function validate($attributes = null, $clearErrors = true)
{
$valid = parent::validate($attributes, $clearErrors);
if (!$valid && $this->throwExceptions) {
throw new $exceptionClass(400, CJSON::encode($this->getErrors()));
}
return $valid;
}
示例2: validate
public function validate()
{
if (!$this->result->getStatus()) {
$this->addErrors(array('social_response_error' => $this->result->getResult()));
return false;
}
return parent::validate();
}
示例3: validate
public function validate()
{
$year = Yii::app()->dateFormatter->format("yyyy", $ths->date);
if (!($year >= 1900 && $year <= 2050)) {
$this->addError('date', 'Данный год не поддерживается системой');
}
return parent::validate();
}
示例4: validate
public function validate($attributes = NULL, $clearErrors = true)
{
$valid = parent::validate();
if ($this->hasErrors()) {
return false;
}
return true;
}
示例5: validatewithId
public function validatewithId($form, $attributes = null, $clearErrors = true)
{
parent::validate($attributes, $clearErrors);
foreach ($form->questions_group as $group) {
if ($group->id == $this->id) {
$this->addError('id', Yii::t('common', 'loginExist'));
}
}
return !$this->hasErrors();
}
示例6: create
public function create()
{
if (false !== parent::validate()) {
$this->name = trim($this->name);
if (null === Yii::app()->authManager->getAuthItem($this->name)) {
Yii::app()->authManager->createAccessLevel($this->name, $this->description);
return true;
} else {
$this->addError('name', 'Group "' . $this->name . '" already exists');
return false;
}
}
return false;
}
示例7: validate
/**
* @param array $attributes
* @param bool $clearErrors
*
* @throws DreamFactory\Platform\Exceptions\ForbiddenException
* @return bool
*/
public function validate($attributes = null, $clearErrors = true)
{
if ($this->_skipped) {
$this->_emailAddress = null;
return true;
}
/** @var User $_user */
if (null === ($_user = User::model()->findByPk(Session::getCurrentUserId()))) {
throw new ForbiddenException();
}
if (empty($this->_emailAddress)) {
$this->_emailAddress = $_user->email;
}
return parent::validate($attributes, $clearErrors);
}
示例8: validate
public function validate($attributes = NULL, $clearErrors = true)
{
$valid = parent::validate();
if (empty($this->email)) {
$this->addError('email', 'Email не может быть пустым.');
return false;
}
if (!User::model()->find('email LIKE "' . $this->email . '"')) {
$this->addError('email', 'Пользователь с таким email не найден.');
return false;
}
if ($this->hasErrors()) {
return false;
}
return true;
}
示例9: validate
/**
* Validates a ProfileFieldType
*
* This is only necessary when its linked to a profileField and the profiletype
* has the current type of profilefieldtype
*
* @return boolean
*/
public function validate($attributes = null, $clearErrors = true)
{
// Bound to a profile field?
if ($this->profileField != null) {
// Current Profile Field matches the selected profile field
if ($this->profileField->field_type_class == get_class($this)) {
return parent::validate($attributes, $clearErrors);
}
}
return true;
}