1
0
mirror of synced 2025-03-10 06:46:09 +03:00

Merge branch 'hotfix/#1338-identity-map-garbage-collection-prevention-on-canceled-remove-2.4' into 2.4

This commit is contained in:
Marco Pivetta 2015-03-17 22:42:48 +00:00
commit 1c8f9ca1cc
2 changed files with 20 additions and 0 deletions

View File

@ -1630,6 +1630,7 @@ class UnitOfWork implements PropertyChangedListener
case self::STATE_REMOVED:
// Entity becomes managed again
unset($this->entityDeletions[$oid]);
$this->addToIdentityMap($entity);
$this->entityStates[$oid] = self::STATE_MANAGED;
break;

View File

@ -229,6 +229,25 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
$this->setExpectedException('InvalidArgumentException');
$this->_unitOfWork->lock(null, null, null);
}
/**
* @group DDC-3619
* @group 1338
*/
public function testRemovedAndRePersistedEntitiesAreInTheIdentityMapAndAreNotGarbageCollected()
{
$entity = new ForumUser();
$entity->id = 123;
$this->_unitOfWork->registerManaged($entity, array('id' => 123), array());
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
$this->_unitOfWork->remove($entity);
$this->assertFalse($this->_unitOfWork->isInIdentityMap($entity));
$this->_unitOfWork->persist($entity);
$this->assertTrue($this->_unitOfWork->isInIdentityMap($entity));
}
}
/**