The following code explains for itself in using simple transaction with Doctrine 1.x ORM in Symfony.

$conn = sfContext::getInstance()->getDatabaseManager()->getDatabase('doctrine')->getDoctrineConnection();
try {
	// The part where you want to do transaction. Add your codes here
	// Commit the transaction when done
} catch (Doctrine_Exception $e) {
	// Rollback if transaction fail

Please help expand this article

Discuss the article:

Comment anonymously. Login not required.