Validates parent to ensure that the model cannot be parent of itself.

@param type $attribute
@param type $params
@return void
180690
public function validateParentChain( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			if( isset( $this->parentId ) && $this->parentId > 0 && $this->parentId == $this->id ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_PARENT_CHAIN ) );
			}
		}
	}
963935
public function validateMobileCreate( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			if( self::isExistByMobile( $this->mobile ) ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_MOBILE_EXIST ) );
			}
		}
	}
780802
public function validateUsernameChange( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			$properties		= CoreProperties::getInstance();
			$existingUser	= self::findById( $this->id );

			if( isset( $existingUser ) && $existingUser->username !== $this->username  && !$properties->isChangeUsername() ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_CHANGE_USERNAME ) );
			}
		}
	}
661652
function(attrs, options) {
        if (options.silent || !this.validate) {
          return;
        }
        attrs = _.extend({}, this.attributes, attrs);
        this.validate(attrs);
      }
823716
protected function checkAttributeAssignable($attribute): void
    {
        if ( ! $this->exceptionOnUnknown || empty($this->known)) {
            // @codeCoverageIgnoreStart
            return;
            // @codeCoverageIgnoreEnd
        }

        if (is_array($attribute)) {

            foreach ($attribute as $singleAttribute) {
                $this->checkAttributeAssignable($singleAttribute);
            }

            return;
        }

        if ( ! in_array($attribute, $this->known, true)) {
            throw (new ModelConfigurationDataException(
                "Unknown model configuration data key: '{$attribute}' in " . get_class($this)
            ))
                ->setDotKey($attribute);
        }
    }
445081
public function validatePassword( $attribute, $params ) {

		if( !$this->hasErrors() ) {

			$user = $this->getUser();

			if( $user && !$user->validatePassword( $this->password ) ) {

				$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_LOGIN_FAILED ) );
			}
		}
	}
830801
public function termsValidator( $attribute, $params ) {

		if( $this->terms === 'on' ) {

			return;
		}

		if( !isset( $this->terms ) || $this->terms <= 0 ) {

			$this->addError( $attribute, Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_TERMS ) );
		}
	}
1217316
public function validateReservedWord($attribute,$params)
	{
		$value=$this->$attribute;
		if(in_array(strtolower($value),self::$keywords))
			$this->addError($attribute, $this->getAttributeLabel($attribute).' cannot take a reserved PHP keyword.');
	}
1320826
public function validateConnectionId($attribute, $params)
    {
        $db = \Yii::app()->getComponent($this->connectionId);
        if ($db === null || !($db instanceof \CDbConnection)) {
            $this->addError('connectionId', 'A valid database connection is required to run this generator.');
        }
    }
1345915
public function validate($attribute, $value, $parameters, $validator)
    {
        list ($name, $locale) = $this->getAttributeNameAndLocale($attribute);

        if ($this->isUnique($value, $name, $locale, $parameters)) {
            return true;
        }

        $this->addErrorsToValidator($validator, $parameters, $name, $locale);

        return false;
    }
60434
public function validateAttribute($model, $attribute)
    {
        $value = $model->$attribute;
        $result = $this->validateValue($value);

        if (!empty($result)) {
            $this->addError($model, $attribute, $this->renderMessage($model, $attribute));
        }
    }
321123
protected function validateIn( $attribute, $value, $parameters )
	{
		if ( is_array( $value ) && $this->hasRule( $attribute, 'Array' ) )
		{
			return count( array_diff( $value, $parameters ) ) == 0;
		}

		return !is_array( $value ) && in_array( (string) $value, $parameters );
	}
1227421
public function normalizeTags($attribute,$params)
	{
		$this->tags=Tag::array2string(array_unique(Tag::string2array($this->tags)));
	}
646981
public function validateClass($attribute, $params)
    {
        $className = @\Yii::import($this->$attribute, true);

        if (!is_string($className) || !$this->classExists($className)) {
            $this->addError($attribute, "Class '$className' does not exist or has syntax error.");
        } elseif (isset($params['extends'])
            && ltrim($className, '\\') !== ltrim($params['extends'], '\\')
            && !is_subclass_of($className, $params['extends'])) {
            $this->addError('baseClass', "Class '$className' must extend from {$params['extends']}.");
        }
    }
320462
public function validateAttribute( $model, $attribute ) {

        $serviceList = $this->getSynchonizer()->getServiceList();

        if ( $model->hasProperty( $attribute ) ) {
            if ( ! is_array( $model->$attribute ) ) {
                $this->addError( $model, $attribute, Yii::t( 'SyncSocial', 'Attribute "{attribute}" must be array', [
                    'attribute' => $attribute
                ] ) );
            } else {
                foreach ( $model->$attribute as $service ) {
                    if ( ! in_array( $service, $serviceList ) ) {
                        $this->addError( $model, $attribute, Yii::t( 'SyncSocial', 'Service list has wrong value' ) );
                    }
                }
            }
        }

    }
1011057
public function validateBetween($attribute, $value, $parameters)
    {
        $this->requireParameterCount(2, $parameters, 'between');

        $size = $this->getSize($attribute, $value);

        return $size >= $parameters[0] && $size <= $parameters[1];
    }
704136
public function validateDistinct($attribute, $value, $parameters)
    {
        $data = Arr::except($this->getDistinctValues($attribute), $attribute);

        if (in_array('ignore_case', $parameters)) {
            return empty(preg_grep('/^'.preg_quote($value, '/').'$/iu', $data));
        }

        return ! in_array($value, array_values($data));
    }