PHP Класс 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.
С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends Validator
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$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]].

Открытые методы

Метод Описание
clientValidateAttribute ( $model, $attribute, $view )
init ( )
validateAttribute ( $model, $attribute )

Защищенные методы

Метод Описание
validateValue ( $value )

Описание методов

clientValidateAttribute() публичный Метод

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

init() публичный Метод

public init ( )

validateAttribute() публичный Метод

public validateAttribute ( $model, $attribute )

validateValue() защищенный Метод

protected validateValue ( $value )

Описание свойств

$integerOnly публичное свойство

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

$integerPattern публичное свойство

the regular expression for matching integers.
public $integerPattern

$max публичное свойство

upper limit of the number. Defaults to null, meaning no upper limit.
См. также: tooBig for the customized message used when the number is too big.
public $max

$min публичное свойство

lower limit of the number. Defaults to null, meaning no lower limit.
См. также: tooSmall for the customized message used when the number is too small.
public $min

$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).
public $numberPattern

$tooBig публичное свойство

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

$tooSmall публичное свойство

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