ActiveQuery Where Clause Question

Hello:

I’m building a search model and I’m running into a problem with the where syntax. What I need is to be able to filter on various fields but have it set up so that the first WHERE clause is always TRUE. But some reason when I use the "orFilterWhere’ its getting ignored. I understand how to do this in straight SQL but is there a way to do this using Yii?

Thanks.




		$query->where("entry_type <> 'M'")

				->orFilterWhere(['like', 'lists.description', $search_criteria])

				->orFilterWhere(['like','memo',$search_criteria])

				->orderBy('tran_date desc');



I figured it out. For anyone else running into this problem you have to do it this way:




$query->filterWhere(['like', 'lists.description', $search_criteria])

				->orFilterWhere(['like','memo',$search_criteria])

				->andWhere("entry_type <> 'M'")

				->orderBy('tran_date desc');