andWhere(['NOT', ['status' => Account::STATUS_DELETED]]); } public function andWhereLogin(string $login): self { return $this->andWhere([$this->getLoginAttribute($login) => $login]); } private function getLoginAttribute(string $login): string { return strpos($login, '@') ? 'email' : 'username'; } }