S
S
sdgs4s4 .2018-02-16 14:23:57
Yii
sdgs4s4 ., 2018-02-16 14:23:57

Yii2 - query in controller -> where?

Hi everyone I
have a request:

$query = Product::find()->where(['status' => '1', 'price2' => ' *** '])->addOrderBy('id DESC');

What should I write instead of *** so that if there is at least some information in the database, the condition would be fulfilled
I can’t find it in the documentation

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
davidnum95, 2018-02-16
@Encoderast

->andWhere(['not', ['price2' => null]])
или
->andWhere(['is not', 'price2', null])

A
Alexander Stepanov, 2018-02-16
@Exebeche

Maybe ['like', 'title', $this->title] ?
Check out ModelSearch for examples

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question