PHP Class yii\validators\RangeValidator

The range can be specified via the [[range]] property. If the [[not]] property is set true, the validator will ensure the attribute value is NOT among the specified range.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends Validator
Datei anzeigen Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$allowArray whether to allow array type attribute.
$not whether to invert the validation logic. Defaults to false. If set to true, the attribute value should NOT be among the list of values defined via [[range]].
$range a list of valid values that the attribute value should be among or an anonymous function that returns such a list. The signature of the anonymous function should be as follows, php function($model, $attribute) { compute range return $range; }
$strict whether the comparison is strict (both type and value must be the same)

Public Methods

Method Description
clientValidateAttribute ( $model, $attribute, $view )
init ( )
validateAttribute ( $model, $attribute )

Protected Methods

Method Description
validateValue ( $value )

Method Details

clientValidateAttribute() public method

public clientValidateAttribute ( $model, $attribute, $view )

init() public method

public init ( )

validateAttribute() public method

public validateAttribute ( $model, $attribute )

validateValue() protected method

protected validateValue ( $value )

Property Details

$allowArray public_oe property

whether to allow array type attribute.
public $allowArray

$not public_oe property

whether to invert the validation logic. Defaults to false. If set to true, the attribute value should NOT be among the list of values defined via [[range]].
public $not

$range public_oe property

a list of valid values that the attribute value should be among or an anonymous function that returns such a list. The signature of the anonymous function should be as follows, php function($model, $attribute) { compute range return $range; }
public $range

$strict public_oe property

whether the comparison is strict (both type and value must be the same)
public $strict