PHP 클래스 yii\validators\EachValidator

~~~php class MyModel extends Model { public $arrayAttribute = []; public function rules() { return [ checks if every category ID is an integer ['categoryIDs', 'each', 'rule' => ['integer']], ] } } ~~~ > Note: This validator will not work with inline validation rules.
부터: 2.0.4
저자: Paul Klimov ([email protected])
상속: extends Validator
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$allowMessageFromRule whether to use error message composed by validator declared via [[rule]] if its validation fails. If enabled, error message specified for this validator itself will appear only if attribute value is not an array. If disabled, own error message value will be used always.
$rule definition of the validation rule, which should be used on array values. It should be specified in the same format as at [[\yii\base\Model::rules()]], except it should not contain attribute list as the first element. For example: php ['integer'] ['match', 'pattern' => '/[a-z]/is'] Please refer to [[\yii\base\Model::rules()]] for more details.

공개 메소드들

메소드 설명
init ( )
validateAttribute ( $model, $attribute )

보호된 메소드들

메소드 설명
validateValue ( $value )

비공개 메소드들

메소드 설명
createEmbeddedValidator ( Model | null $model ) : Validator Creates validator object based on the validation rule specified in [[rule]].
getValidator ( Model | null $model = null ) : Validator Returns the validator declared in [[rule]].

메소드 상세

init() 공개 메소드

public init ( )

validateAttribute() 공개 메소드

public validateAttribute ( $model, $attribute )

validateValue() 보호된 메소드

protected validateValue ( $value )

프로퍼티 상세

$allowMessageFromRule 공개적으로 프로퍼티

whether to use error message composed by validator declared via [[rule]] if its validation fails. If enabled, error message specified for this validator itself will appear only if attribute value is not an array. If disabled, own error message value will be used always.
public $allowMessageFromRule

$rule 공개적으로 프로퍼티

definition of the validation rule, which should be used on array values. It should be specified in the same format as at [[\yii\base\Model::rules()]], except it should not contain attribute list as the first element. For example: php ['integer'] ['match', 'pattern' => '/[a-z]/is'] Please refer to [[\yii\base\Model::rules()]] for more details.
public $rule