Quantcast
Channel: Shani's Php CookBook
Viewing all articles
Browse latest Browse all 60

Yii2 query / query builder: how to use OR condition

$
0
0

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();


Viewing all articles
Browse latest Browse all 60

Trending Articles