diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php
index 19ba6cb..92ae090 100644
--- a/lib/Doctrine/ORM/UnitOfWork.php
+++ b/lib/Doctrine/ORM/UnitOfWork.php
@@ -1636,10 +1636,6 @@ class UnitOfWork implements PropertyChangedListener
 
         $visited[$oid] = $entity; // mark visited
 
-        // Cascade first, because scheduleForDelete() removes the entity from the identity map, which
-        // can cause problems when a lazy proxy has to be initialized for the cascade operation.
-        $this->cascadeRemove($entity, $visited);
-
         $class       = $this->em->getClassMetadata(get_class($entity));
         $entityState = $this->getEntityState($entity);
 
@@ -1667,6 +1663,10 @@ class UnitOfWork implements PropertyChangedListener
                 throw new UnexpectedValueException("Unexpected entity state: $entityState." . self::objToStr($entity));
         }
 
+        // Cascade first, because scheduleForDelete() removes the entity from the identity map, which
+        // can cause problems when a lazy proxy has to be initialized for the cascade operation.
+        $this->cascadeRemove($entity, $visited);
+
     }
 
     /**
