From d0bb8ab2e4e3b6a8014ce4e4f382673b1fe8d260 Mon Sep 17 00:00:00 2001
From: romanb <romanb@625475ce-881a-0410-a577-b389adb331d8>
Date: Mon, 5 Oct 2009 09:32:50 +0000
Subject: [PATCH] [2.0] Fixed EntityManager#contains().

---
 lib/Doctrine/ORM/EntityManager.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/Doctrine/ORM/EntityManager.php b/lib/Doctrine/ORM/EntityManager.php
index 43797fb09..601be248d 100644
--- a/lib/Doctrine/ORM/EntityManager.php
+++ b/lib/Doctrine/ORM/EntityManager.php
@@ -489,7 +489,8 @@ class EntityManager
      */
     public function contains($entity)
     {
-        return $this->_unitOfWork->isInIdentityMap($entity) &&
+        return $this->_unitOfWork->isScheduledForInsert($entity) ||
+                $this->_unitOfWork->isInIdentityMap($entity) &&
                 ! $this->_unitOfWork->isScheduledForDelete($entity);
     }