How can I pass two conditions to the method of query which is where? I tried using $query->where($cond[0]), it worked but on $query->where($cond[1]) it gives an error of undefined offset.
public function search($params, $cond)
{
$query = ServiceStatuses::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => ['defaultOrder' => ['last_hard_state' => SORT_DESC]],
]);
$this->load($params);
.
.
.
$query->where($cond[0]); //<<<<----- This works
$query->where($cond[1]); //<<<<----- Undefined offset: 1
return $dataProvider;
}
public function searchIncidents($params)
{
$cond = array (['last_hard_state' => 0, 'last_hard_state' => 2]);
$dataProvider = $this->search($params, $cond);
return $dataProvider;
}