Answer the question
In order to leave comments, you need to log in
Another error appears General error: 1205 Lock wait timeout exceeded; try restarting transaction?
Why does the above error appear when trying to papdate objects in the Products model? ($model and $modelObject are not Products objects) ??
$transaction = \Yii::$app->db->beginTransaction();
try {
$model->save();
foreach (Yii::$app->request->post('Line') as $t) {
$modelObject = new RevenueItems();
$modelObject->attributes = [
АТТРИБУТЫ
];
$modelObject->save();
Products::updateAll(['quantity' => $newQuantity ], ['id' => АЙДИ_ПРОДУКТА]);
}
$transaction->commit();
} catch (\Exception $e) {
$transaction->rollBack();
throw $e;
}
Products::updateAll(['quantity' => $newQuantity ], ['id' => АЙДИ_ПРОДУКТА]);
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