The example above presumes that the model is based upon [Active Record](active-record.md). For basic form models, scenarios are rarely needed, as the basic form model is normally tied directly to a single form.
The example above presumes that the model is based upon [Active Record](active-record.md). For basic form models,
scenarios are rarely needed, as the basic form model is normally tied directly to a single form.
The default implementation of the `scenarios()`-method will return all scenarios found in the `rules()`
declaration (explained in the next section) so in simple cases you do not need to define scenarios.
Validation
Validation
----------
----------
...
@@ -170,11 +177,11 @@ instance of a [[\yii\validators\Validator]] child class, or an array with the fo
...
@@ -170,11 +177,11 @@ instance of a [[\yii\validators\Validator]] child class, or an array with the fo
```php
```php
[
[
'attribute1, attribute2, ...',
['attribute1','attribute2',...],
'validator class or alias',
'validator class or alias',
// specifies in which scenario(s) this rule is active.
// specifies in which scenario(s) this rule is active.
// if not given, it means it is active in all scenarios
// if not given, it means it is active in all scenarios