0
において、内のテーブルにsinlge行および複数の列を挿入するyii2において、私は別のテーブル内の1つのテーブルにsinlge行ならびに同じIDを持つ複数の行を挿入するyii2別のテーブル
controller code --
$modelcid = $modeld->categoryid;
$modelpc = $modeld->productcode;
$modelqty = $modeld->qty;
$arrayvalue[]= array('id'=>$modelcid,'pc'=>$modelpc,'qty'=>$modelqty);
$i=0;
foreach($arrayvalue as $key=>$val) {
\t $purchaseid = $modeld->purchaseid = $modelm->purchaseid;
\t $cid = $modeld->categoryid =$val['id'][$i];
\t $pc = $modeld->productcode = $val['pc'][$i];
\t $qty = $modeld->qty = $val['qty'][$i];
\t $remarks = $modeld->remarks = $modelm->remarks;
\t if($modeld->save()){
\t \t \t $i++;
\t \t }
\t }
"$modeld->save()" it saves only first entry.