Answer the question
In order to leave comments, you need to log in
How to display data in GridView from hasMany connection through a linked table in yii2?
I'm trying to display data in a GridView from a hasMany connection via a linked table
Here is the connection
public function getRoomOptions()
{
return $this->hasMany(Options::className(), ['id' => 'options_id'])
->viaTable('room_options', ['room_id' => 'id']);
}
$options = $model->roomOptions;
echo GridView::widget([
'dataProvider' => $options,
'summary' => false,
/// ......
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question