getDoctrine()->getEntityManager(); // suspend auto-commit $em->getConnection()->beginTransaction(); // Try and make the transaction try { // Get the account $account = $this->getDoctrine()->getRepository('AcmeStoreBundle:Account')->find($id); // Lower balance $account->setBalance($account->getBalance() - 100); // Save account $em->persist($account); $em->flush(); // Try and commit the transaction $em->getConnection()->commit(); } catch (Exception $e) { // Rollback the failed transaction attempt $em->getConnection()->rollback(); throw $e; }