I’ve checked out transactions in Cakephp, unfortunately it looks as if it only works with in a single model. I have a complicated set of updates and inserts spanning across 11 models. I gather all the information together create the associative arrays representing the data that needs to be updated or inserted, and do all the necessary Model->save() calls.
If any of these fail for any reason, I’d like to roll back everything. Short of just keeping a list of all the calls made and the old data that the calls are replacing and “rolling back” manually, is there any support for this in CakePHP? or what is the best way to accomplish this.
Stephen,
using transactions in CakePHP requires that your database engine supports transactions.
Maybe this comes in handy.
If saving multiple associated models in one run is the task, going for saveAll with atomic option set to true is the way.
Edit0: I wonder it this does any good?