yii2yii2-advanced-appyii-extensions

How to set the condition is null in Yii2 model search?


I want to set the condition which shows all vehicles where the title_recieved is null.

 ->andFilterWhere(['=', 'tr.title_recieved', null])
 ->andFilterWhere(['is', 'tr.title_recieved', null])
 ->andFilterWhere(['is', [ 'tr.title_recieved', null]])

I've tried all the available options, the is null condition works in andWhere, but not in andFilterWhere.


Solution

  • Try With This :

     ->andFilterWhere('tr.title_recieved is NULL');