Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/a2dff996a68ac6244176 to your computer and use it in GitHub Desktop.
Save doctrinebot/a2dff996a68ac6244176 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-890 - https://github.com/doctrine/doctrine2/issues/5415
diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php
index 5088bb2..f774e9c 100644
--- a/lib/Doctrine/ORM/UnitOfWork.php
+++ b/lib/Doctrine/ORM/UnitOfWork.php
@@ -1284,6 +1284,9 @@ class UnitOfWork implements PropertyChangedListener
$class = $this->em->getClassMetadata(get_class($entity));
$entityState = $this->getEntityState($entity);
+
+ $this->cascadeRemove($entity, $visited);
+
switch ($entityState) {
case self::STATE_NEW:
case self::STATE_REMOVED:
@@ -1303,8 +1306,6 @@ class UnitOfWork implements PropertyChangedListener
default:
throw new UnexpectedValueException("Unexpected entity state: $entityState.");
}
-
- $this->cascadeRemove($entity, $visited);
}
/**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment