Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
What is that for?
use Doctrine\ORM\EntityRepository;
class FooRepository extends EntityRepository
public function save(Foo $foo)
$em = $this->getEntityManager();
$uof = $em->getUnitOfWork();
if ($uof->isEntityScheduled($foo)) {
throw new \RuntimeException(sprintf(
'Entity %s is stored in database -> id = %d',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment