Generated for products in admin panel, model, controller and view with Gii. Changed the query to get the model:
$model = Product::find()->with('sizes')->where(['products.id' => $id])->one();
Sizes for the product get through the link:
public function getSizes() { return $this->hasMany(Size::className(),['id' => 'size_id_ref']) ->viaTable(Value::tableName(), ['product_id_ref' => 'id']); } It turns out that in my $model->sizes array of objects (with id and name properties)
For sizes in ActiveForm made the withdrawal of all values from the database
<?= $form->field($model, 'pr_sizes')->checkboxList(ArrayHelper::map(\backend\models\Size::find()->all(), 'id', 'name')) ?> <?= $form->field($model, 'pr_sizes')->dropDownList(ArrayHelper::map(\backend\models\Color::find()->orderBy('name')->all(), 'id', 'name'), ['multiple'=>'multiple']) ?> Tell me how to make dropDownList or checkboxList with multi-selection in _form.php file, so that the dimensions corresponding to the product are immediately substituted into the form. And further so that these dimensions can be updated (write to the table of value values by product id).