validators\Validator isActive()

isActive() public method Returns a value indicating whether the validator is active for the given scenario and attribute. A validator is active if the validator's on property is empty, or the validator's on property contains the specified scenario public boolean isActive ( $scenario )$scenario string Scenario name return boolean Whether the validator applies to the specified scenario.

validators\Validator createValidator()

createValidator() public static method Creates a validator object. public static yii\validators\Validator createValidator ( $type, $model, $attributes, $params = [] )$type string|Closure The validator type. This can be either: a built-in validator name listed in $builtInValidators; a method name of the model class; an anonymous function; a validator class name. $model yii\base\Model The data model to be validated. $attributes array|string List of attributes to be validated. This

validators\Validator init()

init() public method Initializes the object. This method is invoked at the end of the constructor after the object is initialized with the given configuration. public void init ( )

validators\Validator clientValidateAttribute()

clientValidateAttribute() public method Returns the JavaScript needed for performing client-side validation. You may override this method to return the JavaScript validation code if the validator can support client-side validation. The following JavaScript variables are predefined and can be used in the validation code: attribute: an object describing the the attribute being validated. value: the value being validated. messages: an array used to hold the validation error messages for the

validators\Validator addError()

addError() public method Adds an error about the specified attribute to the model object. This is a helper method that performs message selection and internationalization. public void addError ( $model, $attribute, $message, $params = [] )$model yii\base\Model The data model being validated $attribute string The attribute being validated $message string The error message $params array Values for the placeholders in the error message

validators\Validator $whenClient

$whenClient public property A JavaScript function name whose return value determines whether this validator should be applied on the client-side. The signature of the function should be function (attribute, value), where attribute is an object describing the attribute being validated (see clientValidateAttribute()) and value the current value of the attribute. This property is mainly provided to support conditional validation on the client-side. If this property is not set, this validator w

validators\Validator $when

$when public property A PHP callable whose return value determines whether this validator should be applied. The signature of the callable should be function ($model, $attribute), where $model and $attribute refer to the model and the attribute currently being validated. The callable should return a boolean value. This property is mainly provided to support conditional validation on the server-side. If this property is not set, this validator will be always applied on the server-side. The f

validators\Validator $isEmpty

$isEmpty public property A PHP callable that replaces the default implementation of isEmpty(). If not set, isEmpty() will be used to check if a value is empty. The signature of the callable should be function ($value) which returns a boolean indicating whether the value is empty. public callable $isEmpty = null

validators\Validator $skipOnError

$skipOnError public property Whether this validation rule should be skipped if the attribute being validated already has some validation error according to some previous rules. Defaults to true. public boolean $skipOnError = true

validators\Validator $on

$on public property Scenarios that the validator can be applied to. For multiple scenarios, please specify them as an array; for single scenario, you may use either a string or an array. public array|string $on = []