Answer the question
In order to leave comments, you need to log in
How to solve multiinsert problem in yii2?
All the best!
There is this code:
foreach ($attributes as $key => $val) {
if (!$val) continue;
$arFields = [
'worksheet_verify_id' => $wVerifyModel->primaryKey,
'meta_key' => $key,
'meta_val' => $val,
];
if (!$wVerifyModel->isNewRecord) {
WorksheetVerifyMeta::deleteAll([
'worksheet_verify_id' => $wVerifyModel->primaryKey,
'meta_key' => $key,
]);
}
$wVerifyMetaModel->attributes = $arFields;
if($wVerifyMetaModel->getAttribute('ID')){
$wVerifyMetaModel->__unset('ID');
}
if ($wVerifyMetaModel->validate() && $wVerifyMetaModel->save()) {
$isSave = true;
} else {
$this->addErrors($wVerifyMetaModel->getErrors());
$isSave = false;
break;
}
}
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