PHP Class yii\validators\DefaultValueValidator

DefaultValueValidator is not really a validator. It is provided mainly to allow specifying attribute default values when they are empty.
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
$skipOnEmpty this property is overwritten to be false so that this validator will be applied when the value being validated is empty.
$value the default value or an anonymous function that returns the default value which will be assigned to the attributes being validated if they are empty. The signature of the anonymous function should be as follows, php function($model, $attribute) { compute value return $value; }

Public Methods

Method Description
validateAttribute ( $model, $attribute )

Method Details

validateAttribute() public method

public validateAttribute ( $model, $attribute )

Property Details

$skipOnEmpty public_oe property

this property is overwritten to be false so that this validator will be applied when the value being validated is empty.
public $skipOnEmpty

$value public_oe property

the default value or an anonymous function that returns the default value which will be assigned to the attributes being validated if they are empty. The signature of the anonymous function should be as follows, php function($model, $attribute) { compute value return $value; }
public $value