Skip to content

Instantly share code, notes, and snippets.

@Ocramius
Created January 20, 2015 12:59
Show Gist options
  • Save Ocramius/031fda1612b30ae6f255 to your computer and use it in GitHub Desktop.
Save Ocramius/031fda1612b30ae6f255 to your computer and use it in GitHub Desktop.
Multiple nested Doctrine2 EntityManager transactions pseudo-code
<?php
use doctrine\ORM\EntityManagerInterface;
$entityManager->transactional(function (EntityManagerInterface $entityManager) {
// first transaction
$entityManager->transactional(function () {
// nested transaction #1
});
$entityManager->transactional(function () {
// nested transaction #2
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment