Yii2 query / query builder: how to use OR condition

Yii2 query / query builder: how to use OR condition


You can use some thing like this:

$third_res_count=CustomerReservedTimeslots::find()
    ->select(['COUNT(timeslot_id) AS cnt'])
    ->where([
        'test_date' => $today_date,
        'confirmed' => '1',
    ])
    ->andWhere(['>', 'third_user_id', '0'])
    ->andFilterWhere([
        'or',
        ['like', 'status', 'checked in'],
        ['like', 'status', 'Waiting for check in'],
    ])
    ->one();


1 comment

Leave a comment

Your email address will not be published. Required fields are marked *