Creates validation rules for $model property

@param \yii\base\DynamicModel $model
761956
public function addFormValidators(&$model)
    {
        //add validators for basic table filter
        $model->addRule(['table'], 'required');
        $model->addRule(['table'], function() use ($model) {
            return $this->checkTableExists($model);
        });
        //add validators declared in config file
        foreach (Yii::$app->controller->module->filters as $property => $params) {
            $model->addRule($property, 'default');
            if (!isset($params['rules'])) {
                continue;
            }
            foreach ($params['rules'] as $rule) {
                $options = isset($rule['options']) ? $rule['options'] : [];
                $validator = $rule['validator'];
                if (is_string($validator)) {
                    $model->addRule($property, $validator, $options);
                } else {
                    $model->addRule($property, function() use ($model, $validator, $options) {
                        return call_user_func([$validator['class'], $validator['method']], $model, $options);
                    });
                }
            }
        }
    }
1348320
public function enforceModelRelationship($model)
    {
        // Fallback implementation.
        $listener = new TreeEnforcingListener();
        $listener->process(new EnforceModelRelationshipEvent($this->getEnvironment(), $model));
    }
916219
public function afterValidate(Model $model) {
        if ($this->settings[$model->alias]['resetAfter']) {
            $model->validate = array();
        }

        return true;
    }
630381
public static function registerMetaTitle(Component $model)
    {
	    $modelSeoAttributeName = self::behavior($model)->titleAttribute;
	    self::registerSeoMetaTag($model, $modelSeoAttributeName, 'title');
    }
558319
public function afterValidate(Model $model) {
		if (!empty($model->validationErrors)){
			$model->data[$model->alias] = $this->runtime[$model->alias]['data'];
		}
		
		return true;
	}
641891
public function beforeValidationOnUpdate(Event $event, Model $model)
    {
        if($model instanceof ITimestampable) {
            $now = $this->getNow();
            $model->setUpdatedAt($now);
        }
    }
1338617
public static function createFromModel(Model $model)
    {
        $table = $model->getTable();

        $dc = new static($table);

        $dc->strTable = $model->getTable();
        $dc->activeRecord = $model;
        $dc->intId = $model->id;

        return $dc;
    }
797181
protected function reindexModel(Model $model)
    {
        $mapping = $this->option('mapping') ? json_decode(File::get($this->option('mapping')), true) : null;

        $this->info('---> Reindexing ' . get_class($model));

        $model->reindex(
            $this->option('relations'),
            $this->option('batch'),
            $mapping,
            function ($batch)
            {
                $this->info("* Batch ${batch}");
            }
        );
    }
60434
public function validateAttribute($model, $attribute)
    {
        $value = $model->$attribute;
        $result = $this->validateValue($value);

        if (!empty($result)) {
            $this->addError($model, $attribute, $this->renderMessage($model, $attribute));
        }
    }
795339
public function createAuditForm()
    {
        return new \yii\base\DynamicModel(array_merge(['table'], array_keys(Yii::$app->controller->module->filters)));
    }
868950
public function beforeValidate(Model $model, $options = array()) {
        $default = $this->settings[$model->alias]['defaultSet'];

        if (empty($model->validate) && isset($model->validations[$default])) {
            $this->validate($model, $default);
        }

        return true;
    }
558277
public function getModelValidationRules()
    {
        $optionsRules = $this->getOption('rules');

        //if the 'rules' option was provided for this model, it takes precedent
        if (is_array($optionsRules)) {
            return $optionsRules;
        }

        //otherwise look for the rules as a static property on the model
        return $rules = $this->getModelStaticValidationRules() ?: array();
    }
1041001
public function setPostAttribute($model, $attribute)
    {
        if ($attributeValue = Yii::$app->request->post($attribute, null)) {
            $model->setAttribute($attribute, $attributeValue);
        }
    }
296144
public function replaceTags($model)
    {
        if (isset($model->attributes)) {
            foreach ($model->attributes as $key => $attribute) {
                if (in_array($key, $this->dataAttributes)) {
                    $val = Yii::$app->formatter->asDatetime($model->{$key}, 'short');
                } else {
                    $val = $model->{$key};
                }

                $this->subject = str_replace('{' . $key . '}', $val, $this->subject);
                $this->user_subject = str_replace('{' . $key . '}', $val, $this->user_subject);
                $this->text = str_replace('{' . $key . '}', $val, $this->text);
                $this->user_text = str_replace('{' . $key . '}', $val, $this->user_text);
            }
        }

        $table = EmailDetailView::widget([
            'model' => $model,
            'attributes' => $model::$emailAttributes
        ]);

        $this->text = str_replace('{table}', $table, $this->text);
        $this->user_text = str_replace('{table}', $table, $this->user_text);

    }
644709
public function create( $model, $config = [] ) {

		$modelClass	= new static::$modelClass;

		$ignoreSite	= $config[ 'ignoreSite' ] ?? false;

		if( $modelClass::isMultiSite() && !$ignoreSite ) {

			$model->siteId	= $config[ 'siteId' ] ?? Yii::$app->core->siteId;
		}

		$model->save();

		if( $model->id > 0 ) {

			return $model;
		}
		// Handle cases where proper validation is not applied
		else if( YII_DEBUG ) {

			var_dump( $model->getErrors() );
		}

		return false;
	}
391790
public static function insertModel($model)
    {
        foreach(AnnotationManager::getPropertiesAnnotations(BeanFactory::getObjectClass($model), RelationBase::class) as $propertyName => $annotations)
        {
            if(null === $model[$propertyName])
            {
                continue;
            }
            $annotation = $annotations[0];
            Insert::parse($model, $propertyName, $annotation);
        }
    }
1224071
public function validateAttribute($model, $attribute)
    {
        $countries = [];
        if ($this->country !== null) {
            $countries = [$this->country];
        } elseif ($this->countryAttribute !== null) {
            $countries = [$model->{$this->countryAttribute}];
        } elseif (is_array($this->countries) && count($this->countries) > 0) {
            $countries = $this->countries;
        }

        if (count($countries) <= 0) {
            $countries = self::getPhoneUtil()->getSupportedRegions();
        }

        foreach ($countries as $country) {
            try {
                $number = self::getPhoneUtil()->parse($model->$attribute, $country);

                if (self::getPhoneUtil()->isValidNumberForRegion($number, $country)) {
                    if ($this->format) {
                        $model->$attribute = self::getPhoneUtil()->format($number, PhoneNumberFormat::INTERNATIONAL);
                    }

                    $this->_successValidation = true;
                    break;
                }
            } catch (NumberParseException $e) {
                $this->addError($model, $attribute, $this->numberParseExceptionMessage);
            }
        }

        if (!$this->_successValidation) {
            $this->addError($model, $attribute, $this->notValidPhoneNumberMessage);
        }

        return $this->_successValidation;
    }