validators\UniqueValidator $targetAttribute

$targetAttribute public property The name of the ActiveRecord attribute that should be used to validate the uniqueness of the current attribute value. If not set, it will use the name of the attribute currently being validated. You may use an array to validate the uniqueness of multiple columns at the same time. The array values are the attributes that will be used to validate the uniqueness, while the array keys are the attributes whose values are to be validated. If the key and the value

validators\UniqueValidator $message

$message public property The user-defined error message. When validating single attribute, it may contain the following placeholders which will be replaced accordingly by the validator: {attribute}: the label of the attribute being validated {value}: the value of the attribute being validated When validating mutliple attributes, it may contain the following placeholders: {attributes}: the labels of the attributes being validated. {values}: the values of the attributes being validated.

validators\UniqueValidator $filter

$filter public property Additional filter to be applied to the DB query used to check the uniqueness of the attribute value. This can be a string or an array representing the additional query condition (refer to yii\db\Query::where() on the format of query condition), or an anonymous function with the signature function ($query), where $query is the Query object that you can modify in the function. public string|array|Closure $filter = null

validators\UniqueValidator $comboNotUnique

$comboNotUnique public property (available since version 2.0.9) public string $comboNotUnique = null

validators\StringValidator validateValue()

validateValue() protected method Validates a value. A validator class can implement this method to support data validation out of the context of a data model. protected array|null validateValue ( $value )$value mixed The data value to be validated. return array|null The error message and the parameters to be inserted into the error message. Null should be returned if the data is valid. throws yii\base\NotSupportedException if the validator does not supporting data validation withou

validators\StringValidator validateAttribute()

validateAttribute() public method Validates a single attribute. Child classes must implement this method to provide the actual validation logic. public void validateAttribute ( $model, $attribute )$model yii\base\Model The data model to be validated $attribute string The name of the attribute to be validated.

validators\StringValidator 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\StringValidator 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\StringValidator $tooShort

$tooShort public property User-defined error message used when the length of the value is smaller than $min. public string $tooShort = null

validators\StringValidator $tooLong

$tooLong public property User-defined error message used when the length of the value is greater than $max. public string $tooLong = null