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

If i understand right you can use andWhere

 ->andWhere(['not', ['activated_at' => null]])

but andFilterWhere in execute where the related value is not null

from doc

andFilterWhere() Adds an additional WHERE condition to the existing one but ignores empty operands.

for this expression:

WHERE activated_at IS NULL

try this (it's working):

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

$null = new Expression('NULL');

$query->andFilterWhere(['is not', 'asp_id', $null]);


$query->andFilterWhere(['is', 'asp_id', $null]);