In DepDrop-select2 insert the data from the database?

Tell me how in the second select to insert data from a database, the value doesn't work!
<?= $form--->field($model, 'id')->label(")->dropDownList(ArrayHelper::map(Platforms::find()->all(), 'id', 'name'), ['id'=>'platform_id', 'prompt' => '- ' . Yii::t('main', 'Select platform') . '-']) ?>

 <?= $form--->field($model, 'year')->label(")->widget(DepDrop::classname(), [
 'type' => DepDrop::TYPE_SELECT2,
 'options' => ['multiple' => true],
 'disabled' =>false,
'pluginOptions'=>[
'depends'=>['platform_id'],
 'placeholder'=>'- ' . Yii::t('main', 'Select games') . '-',
'url'=>Url::to(['/user/default/getgame'])
]
 ]) 
 ?>
July 4th 19 at 23:51
1 answer
July 4th 19 at 23:53
It is possible for example so:

if (isset($model->year) ){
 $gameValue = ArrayHelper::map(Game::find()->where(['id' => $model->year])->all(), 'id', 'name');
}else{
 $gameValue = []; 


 <?= $form--->field($model, 'year')->label(")->widget(DepDrop::classname(), [
'data' =>$ gameValue,
 'type' => DepDrop::TYPE_SELECT2,
 'options' => ['multiple' => true],
 'disabled' =>false,
'pluginOptions'=>[
'depends'=>['platform_id'],
 'placeholder'=>'- ' . Yii::t('main', 'Select games') . '-',
'url'=>Url::to(['/user/default/getgame'])
]
 ]) 
 ?>

Find more questions by tags Yii