Working with Yii framework 2.0 I have a database table with the columns 'from_date' and 'to_date'. I would like to select and count all records where:
- today is NOT between from_date and to_date. And not even equal these dates (!($from_date <= $today) && !($today <= $to_date))).
OR
- from_date is NULL and to_date is NULL. Because in some records these dates are empty, they need to be selected and counted as well.
I have a model which extends the ActiveRecord class, so I could use the following code to retrieve the data:
ModelClass::find()-where('big>small')->andWhere('1<2')->orWhere('3>1')->count();
I tried to read the documentation of Yii 2.0 but could not figure out how to use NOT BETWEEN OR EQUAL NULL.