I'm working on a Magento module and need to know if it's possible to roll back a series of model saves. Basically, I have five models plus several from my module that I need to save one after the other:
admin/role
admin/user
core/website
core/store_group
core/store
mymodule/model1
mymodule/model2
My problem is that whenever any of these models throw an exception, I need to go into MySQL and manually delete all the rows that were saved. This is very unproductive.
I'm pretty sure that Magento doesn't have a rollback procedure that I can access in my context. For example, I looked in Mage_Core_Model_Abstract
and in the save method, the rollback mechanisms are all protected.
So, my question is, is there some best practice for doing database transactions in Magento that I should be aware of?