In Yii2 how to build queries in design view JOIN?

Good day

you want to make such a request:
Comments::find()
 ->select('p. text, p. date_create, p. firstname, p. lastname')
 ->innerJoin('{{%users}} as u', 'p. user_id = u.id')
 ->where(['s. status' => Comments::STATUS_PUBLIC])


How to specify the short name "c" for the table comments ?

and another question:

How can you contact priceuntil data?

this query is used in ActiveDataProvider
July 2nd 19 at 17:41
2 answers
July 2nd 19 at 17:43
Solution
Comments::find()
 ->select('p. text, p. date_create, p. firstname, p. lastname')
 ->from([Comments::tableName() . 'with'])
 ->innerJoin('{{%users}} as u', 'p. user_id = u.id')
 ->where(['s. status' => Comments::STATUS_PUBLIC])
July 2nd 19 at 17:45
How to specify the short name "c" for the table comments ?

Comments::find()->form(['c' => 'comments'])
and generally it is better to use standard means of data binding

Find more questions by tags YiiPHP