Skip to content

Instantly share code, notes, and snippets.

@janpecha
Forked from cmuench/gist:3082029
Created June 4, 2014 15:41
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save janpecha/bc9566e95f21ad7b2ef0 to your computer and use it in GitHub Desktop.
<?php
// $foo = Mage::getModel('.....
// $bar = Mage::getModel('.....
$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($foo);
$transaction->addObject($bar);
$transaction->save(); // runs save on all objects. On error -> rollback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment