i am using an self-defined func that encapsu findBySql() to return rows .but got the error showed in the title. but if i test to use self-defined func that encapsu find() ,it worked,why?

Here is my action:

```
public function actionList()
{
     $model = new Loan();
     $dataProvider = new ActiveDataProvider(
     [
        'query' => $model->findValid($_GET['type']),//error comes here
        'pagination' => [
                        'pagesize' => '2',
         ],
     ]);

      return $this->renderPartial('list', ['model' => $model, 'dataProvider' => $dataProvider]);
}

```

Here is the object loan's findxx function:

```
 public function findValid($type=null)
{
    if($type==null){
            return static::findBySql("select * from loan where wmstat&1=1 and (wmstat>>2)&1=0")->all();
    }else{
            return static::findBySql("select * from loan where wmstat&1=1 and (wmstat>>2)&1=0 and origin="."'".$type."'")->all();
    }
}

```

Futher more,can i change the bit operatin using find() and where() and achieve the same effect ?