I'm (trying to) wrap the saving of a model in a transaction, but even after a rollback, the new record still gets committed.
In my model, I begin a transaction in beforeSave()
. Then in afterSave()
I do some other stuff, then commit or rollback. The begin and rollback are being executed, but the query isn't rolled back.
My query log:
22934 Query START TRANSACTION
22933 Query INSERT INTO `interaction` (`id_person`, `date_created`, `date_edited`, `id_created`, `id_edited`, `int_type`, `status`) VALUES ('myUsername', DEFAULT, '2018-03-15 15:10:17', 'myUsername', 'myUsername', 7, DEFAULT)
22933 Query SELECT IF(COUNT(*) > 0, 1, 0) FROM `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_NAME` = 'interaction_corepie' AND `TABLE_SCHEMA` = DATABASE()
22933 Query DESCRIBE `interaction_corepie`
22934 Query ROLLBACK
The record created by that INSERT
statement doesn't get rolled back.