Data provider query string

I’m trying to set some filters for the data provider on my gridview. I want to only display my “Course” model records that have a status of 10 OR 90. This means it should return all Course records that have a status of either 10 or 90. I can filter one status easily with the following code…




$searchModel = new CourseQuery(); 

$dataProvider = $searchModel->search(['CourseQuery'=>['status'=>90]])



However, I do not know how to make the filter work when searching for two status. I thought it would be something like this…




$searchModel = new CourseQuery(); 

$dataProvider = $searchModel->search(['CourseQuery'=>['status'=>90, 'status'=>10]])



Unfortunately this does not work. Does anyone know how to filter an attribute based on two values instead of one? I need to search for two seperate values on the same query param.

You have many choices …




$dataProvider = $searchModel->search(['CourseQuery'=>['status = :v1 OR status = :v2', ':v1' => 10, ':v2' => 90]]);



OR




$dataProvider = $searchModel->search(['CourseQuery'=>['status' => [10,90] ] ]);



Thank you very much Fabrizio.