When you save your multiple Model Object object then I want to provide Transaction. How can I achieve in magento?
Any one Please Guide Me?
I hope I understood correctly your question.
If you want to save X objects at once and roll back all of them in case something goes wrong try this.
$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($obj1);
$transaction->addObject($obj2);
...
$transaction->addObject($objX);
$transaction->save();
This will call ->save()
for each object you added using addObject
but everything will be done inside a transaction.
Have a look e.g. into \Mage_Eav_Model_Entity_Abstract::saveAttribute
public function saveAttribute(Varien_Object $object, $attributeCode)
{
// ...
$adapter = $this->_getWriteAdapter();
// ...
$adapter->beginTransaction();
try {
// ...
$adapter->commit();
} catch (Exception $e) {
$adapter->rollback();
throw $e;
}
return $this;
}
multiple Model Object
?