如何在 Yii2 模型搜索中设置条件为空?

raj*_*766 2 yii-extensions yii2 yii2-advanced-app

我想设置显示 title_recived 为空的所有车辆的条件

 ->andFilterWhere(['=', 'tr.title_recieved', null])
    ->andFilterWhere(['is', 'tr.title_recieved', null])
    ->andFilterWhere(['is', [ 'tr.title_recieved', null]])
Run Code Online (Sandbox Code Playgroud)

尝试了所有可用的选项,空条件在 andWhere 中工作但不在 andfilterwhere 中工作?

小智 5

在查询中使用andWhere。

->andWhere(['tr.title_recieved' => null]);
Run Code Online (Sandbox Code Playgroud)