public function checkEmail($attribute) { if (!$this->hasErrors()) { $user = User::find()->where(['email' => $attribute])->one(); if (!$user) { $this->addError($attribute, 'Incorrect email.'); } } }