I have questions on why the below is not working
Book::find()->where([
'status' => STATUS_APPROVED,
['not', ['paid_date' => NULL]]
]);
I have questions on why the below is not working
Book::find()->where([
'status' => STATUS_APPROVED,
['not', ['paid_date' => NULL]]
]);
Did you miss ->one() or ->all() ?
For example:
Book::find()->where([
'status' => STATUS_APPROVED,
['not', ['paid_date' => NULL]]
])->all();
I have ->all(). The error I got is
PHP Warning – yii\base\ErrorException
strtoupper() expects parameter 1 to be string, array given
Every sub condition in a hash format has to be a ‘key’ - ‘value’ pair.
['not', ['paid_date' => NULL]]
This is in operator format, which can not be used as an element in a hash format.
Use ‘operator’ format of ‘AND’ as a whole.
Book::find()->where([
'and',
['status' => STATUS_APPROVED],
['not', ['paid_date' => NULL]]
]);
http://www.yiiframework.com/doc-2.0/yii-db-queryinterface.html#where()-detail
thanks, didnt know about this