I'm using the widget widget along with yii2 and I'm having a commit-time error.
My scenario is as follows: In my catalog form the user can create the catalog , create as many catalog items as he wants. That is, I use in the catalog creation form the multi input widget to create multiple records of type catalog items
I'm having the following error:
Myformcode:
<?=$form->field($model,'mensagem2')->textInput(['maxlength'=>true])?><?php$models=Ponto_venda::find()->asArray()->all();$map=ArrayHelper::map($models,'id_ponto_v',function($model,$defaultValue){return$model['nome'].'-'.$model['descricao'];});?><divclass="row">
<div class="col-lg-11">
<?= $form->field($model, 'ponto_venda_id_ponto_v')->dropDownList($map) ?>
</div>
<div class="col-lg-1">
<a class="btn btn-primary" href="index.php?r=ponto_venda%2Fcreate" role="button" style="margin-top:25px;"><span class="glyphicon glyphicon-plus"></span></a>
</div>
</div>
<!-- Parte dos itens do catalogo -->
<?php
$item_models = Cerveja::find()->asArray()->all();
$item_map = ArrayHelper::map($item_models, 'id_cerveja', function($item, $defaultValue) {return $item['nome'].' - '.$item['marca_id_marca'];});
?>
<br/>
<?= $form->field($item, 'Item_catalogo')->widget(MultipleInput::className(), [
'max' => 4,
'columns' => [
[
'name' => 'cerveja_id_cerveja',
'type' => 'dropDownList',
'title' => 'Cerveja',
'items' =>$item_map
],
[
'name' => 'preco1',
'enableError' => true,
'title' => 'Preço1',
],
[
'name' => 'preco2',
'enableError' => true,
'title' => 'Preço2',
],
[
'name' => 'preco3',
'enableError' => true,
'title' => 'Preço3',
],
]
]);
?>
<!-- -->
I can not understand why the error to commit the catalog items being that POST is apparently all respecting the integrity rules ... I'm new to the framework ... Thanks!