PersianBehavior::afterValidate()

@param mixed $model
@return
558319
public function afterValidate(Model $model) {
		if (!empty($model->validationErrors)){
			$model->data[$model->alias] = $this->runtime[$model->alias]['data'];
		}
		
		return true;
	}
1296533
public function handle($model)
    {
        if (! $model -> isUserstamping()) {
            return;
        }

        if (is_null($model -> {$model -> getCreatedByColumn()})) {
            $model -> {$model -> getCreatedByColumn()} = auth() -> id();
        }

        if (is_null($model -> {$model -> getUpdatedByColumn()}) && ! is_null($model -> getUpdatedByColumn())) {
            $model -> {$model -> getUpdatedByColumn()} = auth() -> id();
        }
    }
553387
public function validate($value)
    {
        $return = $this->validateCommon($value, new ValidateResult($value, true));

        if ($return->status === false) {
            return $return;
        }

        return $this->validateNumber($return->value);
    }
1155291
protected function performAjaxValidation($model) {
    if (Yii::$app->request->isAjax && !Yii::$app->request->isPjax) {
      if ($model->load(Yii::$app->request->post())) {
        Yii::$app->response->format = Response::FORMAT_JSON;
        echo json_encode(ActiveForm::validate($model));
        Yii::$app->end();
      }
    }
  }
105413
public function afterValidate()
    {
        //保存原图
        if (($this->_originalImage = $this->file->saveAsTempFile()) == false) {
            $this->addError('file', Yii::t('yuncms', 'Failed to save the image.'));
        }
        parent::afterValidate();
    }
56223
public function afterValidate()
    {
        $translations = $this->getModelTranslations();

        $isValid = Model::validateMultiple($translations, $this->translationAttributeList);

        if (!$isValid) {
            foreach ($translations as $translation) {
                foreach ($translation->getErrors() as $attribute => $errors) {
                    $attribute = \strtr($this->attributeNamePattern, [
                        '%name%' => $attribute,
                        '%language%' => $translation->{$this->translationLanguageAttrName},
                    ]);

                    if (\is_array($errors)) {
                        foreach ($errors as $error) {
                            $this->owner->addError($attribute, $error);
                        }
                    } else {
                        $this->owner->addError($attribute, $errors);
                    }
                }
            }
        }
    }
260364
protected function afterValidation($data)
  {
    if ($this->after_validation) {
      $data = call_user_func_array($this->after_validation, array($data, $this));
    }

    return $data;
  }
447772
public function persist($model, $errors = array(), $data = array()) {
		if (is_a($model, 'Model')) {
			$errors = $model->validationErrors;
			$data = $model->data;
			$model = $model->alias;
		}

		return $this->Session->write("$this->sessionKey.$model", compact('data', 'errors'));
	}
206056
private function validate(string $value) : void
    {
        foreach ($this->validators as $validator) {
            if (! $validator->isValid($value)) {
                foreach ($validator->getFailureMessages() as $messageKey => $message) {
                    $this->addTranslatableError($messageKey, $message);
                }
            }
        }
    }
648603
public static function errorCheck($model)
    {
        $className = self::getCleanClassName($model);

        if (strpos($className, 'Search') !== false) {
            if (strlen($model->_query) < 3) {
                $model->_error = 400;
            }
        }

        if (!$model->_error) {
            $header = self::getHeader($model->_url);
            if ($header == 200) {
                if ($className != 'UserListModel') {
                    $additionalSetting = ($className == 'CharacterPeoplePictureModel');
                    $model->_parser = self::getParser($model->_url, $model->_parserArea, $additionalSetting);
                }
            } else {
                $model->_error = $header;
            }
        }
    }
1282351
public function setModel($model)
    {
        if ($model instanceof Model) {
            $this->model = $model;
        } else {
            $this->model = Yii::createObject($model);
        }

        $model = $this->model;
        $this->updateFormName();

        if (empty($this->getScenario())) {
            $this->setScenario($model->scenario);
        }

        return $this->model;
    }
983793
protected function callAfterCallbacks(array $afterCallbacks, $model, $state)
    {
        if (! isset($afterCallbacks[$this->class][$state])) {
            return;
        }

        foreach ($afterCallbacks[$this->class][$state] as $callback) {
            $callback($model, $this->faker);
        }
    }
286939
public static function validate($value)
    {
        if (!is_array($value)) {
            return false;
        }
        if (isset($value['from']) && IdentityValidator::validate($value['from']) === false) {
            return false;
        }
        if (isset($value['to']) && IdentityValidator::validate($value['to']) === false) {
            return false;
        }
        if (!isset($value['topics']) || !is_array($value['topics'])) {
            return false;
        }
        foreach ($value['topics'] as $topic) {
            if (IdentityValidator::validate($topic) === false) {
                return false;
            }
        }
        if (!isset($value['payload'])) {
            return false;
        }
        if (HexValidator::validate($value['payload']) === false) {
            return false;
        }
        if (!isset($value['priority'])) {
            return false;
        }
        if (QuantityValidator::validate($value['priority']) === false) {
            return false;
        }
        if (!isset($value['ttl'])) {
            return false;
        }
        if (isset($value['ttl']) && QuantityValidator::validate($value['ttl']) === false) {
            return false;
        }
        return true;
    }
1128505
public static function validate($value)
    {
        if (!is_array($value)) {
            return false;
        }
        if (isset($value['to']) && IdentityValidator::validate($value['to']) === false) {
            return false;
        }
        if (!isset($value['topics']) || !is_array($value['topics'])) {
            return false;
        }
        foreach ($value['topics'] as $topic) {
            if (is_array($topic)) {
                foreach ($topic as $subTopic) {
                    if (HexValidator::validate($subTopic) === false) {
                        return false;
                    }
                }
                continue;
            }
            if (HexValidator::validate($topic) === false) {
                if (!is_null($topic)) {
                    return false;
                }
            }
        }
        return true;
    }
634671
protected function validateAttributeInternal($model, $attribute)
    {
        $value = $model->{$attribute};

        $result = ($this->type == FormatHelper::TYPE_LIST)
            ? $this->validateListValue($model, $value)
            : $this->validateValue($value);

        if (!empty($result)) {
            $this->addError($model, $attribute, $result[0], $result[1]);

            return;
        }

        Yii::info('Type validation success'
            . PHP_EOL . "Result value for '$attribute': {$this->filteredAttribute}", __METHOD__);
        $model->{$attribute} = $this->filteredAttribute;
    }
1076815
public function persianAlpha(Model $model, $value) {
		$value = current($value);
	
		if (is_string($value) && preg_match("/^[\p{Arabic}\x{200C}\x{200D}\s\-]+$/u", $value)) {
			return true;
		}
		return false;
	}
720650
protected function performAjaxValidation($model)
    {
        $result = ($model instanceof Model)
            ? ActiveForm::validate($model)
            : ActiveForm::validateMultiple($model);

        $response = Yii::$app->getResponse();

        if (!empty($result) && $ajaxRedirect = Yii::$app->getSession()->get('site_ajax_redirect')) {
            $response = $response->redirect($ajaxRedirect);
            Yii::$app->getSession()->remove('site_ajax_redirect');
        } else {
            $response->format = Response::FORMAT_JSON;
            $response->data = $result;
        }

        return $response;
    }