PHP Class yii\validators\FilterValidator

FilterValidator is actually not a validator but a data processor. It invokes the specified filter callback to process the attribute value and save the processed value back to the attribute. The filter must be a valid PHP callback with the following signature: php function foo($value) { compute $newValue here return $newValue; } Many PHP functions qualify this signature (e.g. trim()). To specify the filter, set [[filter]] property to be the callback.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends Validator
ファイルを表示 Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$filter the filter. This can be a global function name, anonymous function, etc. The function signature must be as follows, php function foo($value) { compute $newValue here return $newValue; }
$skipOnArray whether the filter should be skipped if an array input is given. If true and an array input is given, the filter will not be applied.
$skipOnEmpty this property is overwritten to be false so that this validator will be applied when the value being validated is empty.

Public Methods

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

Method Details

clientValidateAttribute() public method

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

init() public method

public init ( )

validateAttribute() public method

public validateAttribute ( $model, $attribute )

Property Details

$filter public_oe property

the filter. This can be a global function name, anonymous function, etc. The function signature must be as follows, php function foo($value) { compute $newValue here return $newValue; }
public $filter

$skipOnArray public_oe property

whether the filter should be skipped if an array input is given. If true and an array input is given, the filter will not be applied.
public $skipOnArray

$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