L
L
LittleFatNinja2016-09-16 12:26:04
Yii
LittleFatNinja, 2016-09-16 12:26:04

How to combine query conditions in query builder in yii2?

(new Query)
->select('*')
...
->andWhere(['<', 'time', new Expresion('NOW()')])
->andWhere(['<', 'rating', '5']);

is it possible to somehow unite the forces of the builder into something like
...
->andWhere([
  ['<', 'time', new Expresion('NOW()')],
  ['<', 'rating', '5']
]);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2016-09-16
@mhthnz

If I don't confuse anything

->andWhere(['and',
  ['<', 'time', new Expresion('NOW()')],
  ['<', 'rating', '5']
]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question