How to do IS NULL and IS NOT NULL with Yii 2 ActiveRecord?

后端 未结 5 2036
情话喂你
情话喂你 2021-02-12 10:22

I have a table which has a field `activated_at` timestamp NULL DEFAULT NULL, which means that it can contain a timestamp or it can be null and it\'s

5条回答
  •  深忆病人
    2021-02-12 10:56

    for this expression:

    WHERE activated_at IS NULL
    

    try this (it's working):

    ->andWhere(['is', 'activated_at', new \yii\db\Expression('null')]),
    

提交回复
热议问题