public static function findByUsernameOrEmail($username, $checkStatus = true)
    {
        $query = static::find();
        $query->where(['or', ['username' => $username], ['email' => $username]]);
        if ($checkStatus) {
            $query->andWhere(['status' => self::STATUS_ACTIVE]);
        }
        return $query->limit(1)->one();
    }
public static function findByUsernameOrEmail($username, $checkStatus = true)
    {
        $query = static::find();
        $query->where(['or', ['username' => $username], ['email' => $username]]);
        if ($checkStatus) {
            $query->andWhere(['status' => self::STATUS_ACTIVE]);
        }
        return $query->limit(1)->one();
    }
public static function findByUsernameOrEmail ( $ username , $ checkStatus = true ) { $ query = static :: find ( ) ; $ query -> where ( [ 'or' , [ 'username' => $ username ] , [ 'email' => $ username ] ] ) ; if ( $ checkStatus ) { $ query -> andWhere ( [ 'status' => self :: STATUS_ACTIVE ] ) ; } return $ query -> limit ( 1 ) -> one ( ) ; }
Finds user by username or email

@param string $username
@param bool $checkStatus
@return null|static
Finds user by username or email