Есть запрос.
Код: Выделить всё
$statuses_ids = [1,2,3];
$box = Box::find()->where(['NOT IN', 'status', $statuses_ids])->all();
Код: Выделить всё
$statuses_ids = [1,2,3];
$box = Box::find()->where(['NOT IN', 'status', $statuses_ids])->all();
Код: Выделить всё
$box = Box::find()->where(['NOT IN', 'status', $statuses_ids])->orWhere(['IS', 'status', null])->all();
Так не будет работать, а так будетUsick писал(а): ↑2019.10.15, 17:08Код: Выделить всё
$box = Box::find()->where(['NOT IN', 'status', $statuses_ids])->orWhere(['IS', 'status', null])->all();
Код: Выделить всё
$box = Box::find()->where(['NOT IN', 'status', $statuses_ids])->orWhere(['IS', 'status', new \yii\db\Expression('NULL')])->all();
Работает без проблем.yiiliveext писал(а): ↑2019.10.15, 17:13Так не будет работать, а так будетUsick писал(а): ↑2019.10.15, 17:08Код: Выделить всё
$box = Box::find()->where(['NOT IN', 'status', $statuses_ids])->orWhere(['IS', 'status', null])->all();
Код: Выделить всё
$box = Box::find()->where(['NOT IN', 'status', $statuses_ids])->orWhere(['IS', 'status', new \yii\db\Expression('NULL')])->all();
Значит исправили в последних версиях, раньше не работало.
Код: Выделить всё
$box = Box::find()->where(['NOT IN', 'status', $statuses_ids])->orWhere(['status' => null])->all();