Greater than and smaller than in Active Record

I know that there is a workaround to make a "select * from table where id > 2" that its

Table::find()->where('id > :id', [':id' => '2']])->all();

But I’d prefer using the usual associative where() method, so, is there a way to make this using the where method with associative arrays like:

Table::find()->where(['>',['id' => '2']]->all();

Or something like this?


Table::find()->where([’>’, ‘id’, ‘2’])->all();

1 Like