Merge branch 'hotfix/#1338-identity-map-garbage-collection-prevention-on-canceled-remove'
Close #1338
This commit is contained in:
commit
ce41e35c1f
@ -1684,6 +1684,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;
|
||||
|
@ -302,6 +302,25 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
|
||||
$this->_unitOfWork->computeChangeSet($metadata, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data Provider
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user