public static function findByKeyfield($keyfield, $status = self::STATUS_ACTIVE)
    {
        if ($status === null) {
            return static::find()->where(['or', ['email' => $keyfield], ['username' => $keyfield]])->limit(1)->one();
        }
        return static::find()->where(['and', ['status' => $status], ['or', ['email' => $keyfield], ['username' => $keyfield]]])->limit(1)->one();
    }
public static function findByKeyfield($keyfield, $status = self::STATUS_ACTIVE)
    {
        if ($status === null) {
            return static::find()->where(['or', ['email' => $keyfield], ['username' => $keyfield]])->limit(1)->one();
        }
        return static::find()->where(['and', ['status' => $status], ['or', ['email' => $keyfield], ['username' => $keyfield]]])->limit(1)->one();
    }
public static function findByKeyfield ( $ keyfield , $ status = self :: STATUS_ACTIVE ) { if ( $ status === null ) { return static :: find ( ) -> where ( [ 'or' , [ 'email' => $ keyfield ] , [ 'username' => $ keyfield ] ] ) -> limit ( 1 ) -> one ( ) ; } return static :: find ( ) -> where ( [ 'and' , [ 'status' => $ status ] , [ 'or' , [ 'email' => $ keyfield ] , [ 'username' => $ keyfield ] ] ] ) -> limit ( 1 ) -> one ( ) ; }
Finds user of given status by username or email.
@param string $keyfield value to compare
@param int $status
@return static|null
Finds user of given status by username or email .