M
M
maks_pain_002020-03-07 22:44:01
Yii
maks_pain_00, 2020-03-07 22:44:01

How to join query with table in Yii2?

How to join in query by INNER JOIN with table 'photo' by 'id_product'?

$model = Product::find()->where(['popular'=>'1'])->all();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Osadchyi, 2020-03-07
@maks_pain_00

Product::find()
->innerJoin('photo', 'photo.id_product = product.id')
->where(['popular'=>'1'])
->all();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question