Problem by creating scenarios

Hi guys, I used to create scenario like this in Controller




$model = new KontaktMail(['scenario' => 'create_mail']);



In Model, I used to implement rule for scenario like this:





    public function rules() {

        return [

            [['id_e_kontakt', 'id_kontakt_verwendungszweck', 'standard', 'aktiv', 'angelegt_von', 'aktualisiert_von', 'optimistic_lock'], 'integer'],

            [['zuletzt_deaktiviert_am', 'angelegt_am', 'aktualisiert_am', 'id_kontakt_verwendungszweck', 'mail', 'standard', 'aktiv'], 'safe'],

            ['mail', 'email'],

            //fourth line 

            [['id_kontakt_verwendungszweck', 'mail', 'standard', 'aktiv'], 'required','on'=>'create_mail'], 

            [['aktiv'], 'default', 'value' => '1'],

            [['standard'], 'default', 'value' => '0'],

            [['optimistic_lock'], 'default', 'value' => '0'],

            [['optimistic_lock'], 'mootensai\components\OptimisticLockValidator']

        ];

    }



Without fourth line, I get no problems. With this rule, i will get error like this




Unknown Property –

yii\base\UnknownPropertyException

                

Setting unknown property: mootensai\components\OptimisticLockValidator::value



My intention is creating one scenario, in which attributes [‘id_kontakt_verwendungszweck’, ‘mail’, ‘standard’, ‘aktiv’] are required and another scenario, in which theses attributes aren’t required, but safe!

Any ideas, what I do wrong? I assume, that scenario rules are not implemented completely, but I’m not experienced handling scenarios.

From the looks of it, it seems the mootensai\components\OptimisticLockValidator doesn’t properly implement the validation interface, is missing the value property and yii complaints about this.

And how to get this problem fixed?

Without creating scenarios, everything is gonna all right. So, it’s not mootensai, who 'causes bug, but scenario combined with validator of mootensaI: I don’t want to to remove this widget, 'cause it’s looking after my optimistic lock behaviour reliable. What else colud I do?

By now, I’m removing faulty Validator in order to get scenario doing its job