base\Model scenarios()

scenarios() public method

Returns a list of scenarios and the corresponding active attributes.

An active attribute is one that is subject to validation in the current scenario. The returned array should be in the following format:

[
    'scenario1' => ['attribute11', 'attribute12', ...],
    'scenario2' => ['attribute21', 'attribute22', ...],
    ...
]

By default, an active attribute is considered safe and can be massively assigned. If an attribute should NOT be massively assigned (thus considered unsafe), please prefix the attribute with an exclamation character (e.g. '!rank').

The default implementation of this method will return all scenarios found in the rules() declaration. A special scenario named SCENARIO_DEFAULT will contain all attributes found in the rules(). Each scenario will be associated with the attributes that are being validated by the validation rules that apply to the scenario.

public array scenarios ( )
return array

A list of scenarios and the corresponding active attributes.

doc_Yii
2016-10-30 16:51:56
Comments
Leave a Comment

Please login to continue.