AR2019-01-11 16:35:18
AR, 2019-01-11 16:35:18

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 {
                foreach (Yii::$app->request->post('Line') as $t) {
                    $modelObject = new RevenueItems();
                    $modelObject->attributes = [
                    Products::updateAll(['quantity' => $newQuantity ], ['id' => АЙДИ_ПРОДУКТА]);
            } catch (\Exception $e) {
                throw $e;

That is, without the line:
Products::updateAll(['quantity' => $newQuantity ], ['id' => АЙДИ_ПРОДУКТА]);

Everything works as it should. What could be the problem ?
Thanks in advance

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question