PHP Class yii\validators\NumberValidator

The format of the number must match the regular expression specified in [[integerPattern]] or [[numberPattern]]. Optionally, you may configure the [[max]] and [[min]] properties to ensure the number is within certain range.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends Validator
Mostrar archivo Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$integerOnly whether the attribute value can only be an integer. Defaults to false.
$integerPattern the regular expression for matching integers.
$max upper limit of the number. Defaults to null, meaning no upper limit.
$min lower limit of the number. Defaults to null, meaning no lower limit.
$numberPattern the regular expression for matching numbers. It defaults to a pattern that matches floating numbers with optional exponential part (e.g. -1.23e-10).
$tooBig user-defined error message used when the value is bigger than [[max]].
$tooSmall user-defined error message used when the value is smaller than [[min]].

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

$integerOnly public_oe property

whether the attribute value can only be an integer. Defaults to false.
public $integerOnly

$integerPattern public_oe property

the regular expression for matching integers.
public $integerPattern

$max public_oe property

upper limit of the number. Defaults to null, meaning no upper limit.
See also: tooBig for the customized message used when the number is too big.
public $max

$min public_oe property

lower limit of the number. Defaults to null, meaning no lower limit.
See also: tooSmall for the customized message used when the number is too small.
public $min

$numberPattern public_oe property

the regular expression for matching numbers. It defaults to a pattern that matches floating numbers with optional exponential part (e.g. -1.23e-10).
public $numberPattern

$tooBig public_oe property

user-defined error message used when the value is bigger than [[max]].
public $tooBig

$tooSmall public_oe property

user-defined error message used when the value is smaller than [[min]].
public $tooSmall