base\DynamicModel addRule()

addRule() public method

Adds a validation rule to this model.

You can also directly manipulate $validators to add or remove validation rules. This method provides a shortcut.

public $this addRule ( $attributes, $validator, $options = [] )
$attributes string|array

The attribute(s) to be validated by the rule

$validator mixed

The validator for the rule.This can be a built-in validator name, a method name of the model class, an anonymous function, or a validator class name.

$options array

The options (name-value pairs) to be applied to the validator

return $this

The model itself

doc_Yii
2016-10-30 16:51:29
Comments
Leave a Comment

Please login to continue.