S
S
Snewer2018-03-03 16:55:26
Yii
Snewer, 2018-03-03 16:55:26

Why is the transaction not opening?

Hello!
Why is the transaction not opened with the following code?

$transaction = Yii::$app->db->beginTransaction();
Yii::$app->db->createCommand('DELETE FROM profiles WHERE id = 1000')->execute();
$transaction->rollBack();

And this is how it works:
$transaction = Yii::$app->db->beginTransaction();
$transaction->begin();
Yii::$app->db->createCommand('DELETE FROM profiles WHERE id = 1000')->execute();
$transaction->rollBack();

What can be wrong?

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