Question on using unsafe modifier in Yii2 model rules

I’m wondering with regards to using the unsafe modifier “!” in a models rules method if I am safe in assuming this modifier is optional if it has already been included in the scenarios method like so:




public function scenarios() {

    return [

        'default' => ['some_id', '!secret'],

    ];

}

So…




public function rules() {

    return [

        [['some_id', '!secret'], 'trim'],

    ];

}



…would be the same as doing:




public function rules() {

    return [

        [['some_id', 'secret'], 'trim'],

    ];

}



However, I assume that the only time it would be required in the rules method is if you didn’t override the scenarios method and hence the attributes would automatically be built?

Yes.

Thank you!