UniqueValidator and validateValue

Hello!

I was trying to use UniqueValidator in console application as standalone validator and found that it does not support validateValue() method.

Is there any specific reason for that or it is just not implemented yet?

This is what i’m trying to do:




        $email = $this->prompt("Email: ", [

            'required' => true,

            'validator' => function($value, &$error) {

                if ((new \yii\validators\EmailValidator)->validate($value, $error)) {

                    return (new \yii\validators\UniqueValidator([

                        'targetClass' => User::className(),

                        'targetAttribute' => 'email',

                    ]))->validate($value, $error);

                }

                return false;

            },

        ]);