Hi, everyone!
I have a next query
$model = SubCategory::find()
->select('*')
->joinWith([
'category' => function ($query) {
$query->joinWith('surveyCategories')
->andWhere(['survey_category.survey_id' => $var]);
},
])
->where([
'survey_category.survey_id' => $var,
])
->all();
So while joining "category" table with its function($query) I need to pass variable $var right there. Please, help me and clarify this moment.
Thanks.