Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 416 Bytes

README.md

File metadata and controls

19 lines (15 loc) · 416 Bytes

yii2-validation-rules

for yii2

It's a wrapper on a current rules in \yii\base\Model. See discussion: https://github.com/yiisoft/yii2/issues/16027

TODO: add tests.

Use ValidationRule.

public function rules()
{
    return [
        ValidationRule::attributes(['foo', 'bar'])->required()->build(),
        ValidationRule::atribute('foo')->string()->min(6)->on(self::SCENARIO_DEFAULT)->build()
    ];
}