Merge branch 'DDC-1659'
This commit is contained in:
commit
85d1707a2b
@ -1395,6 +1395,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
|
||||
if (isset($this->identityMap[$className][$idHash])) {
|
||||
unset($this->identityMap[$className][$idHash]);
|
||||
unset($this->readOnlyObjects[$oid]);
|
||||
|
||||
//$this->entityStates[$oid] = self::STATE_DETACHED;
|
||||
|
||||
@ -2209,6 +2210,7 @@ class UnitOfWork implements PropertyChangedListener
|
||||
$this->collectionDeletions =
|
||||
$this->collectionUpdates =
|
||||
$this->extraUpdates =
|
||||
$this->readOnlyObjects =
|
||||
$this->orphanRemovals = array();
|
||||
|
||||
if ($this->commitOrderCalculator !== null) {
|
||||
|
@ -15,9 +15,12 @@ class ReadOnlyTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
try {
|
||||
$this->_schemaTool->createSchema(array(
|
||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\ReadOnlyEntity'),
|
||||
));
|
||||
} catch(\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
public function testReadOnlyEntityNeverChangeTracked()
|
||||
@ -36,6 +39,36 @@ class ReadOnlyTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->assertEquals("Test1", $dbReadOnly->name);
|
||||
$this->assertEquals(1234, $dbReadOnly->numericValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1659
|
||||
*/
|
||||
public function testClearReadOnly()
|
||||
{
|
||||
$readOnly = new ReadOnlyEntity("Test1", 1234);
|
||||
$this->_em->persist($readOnly);
|
||||
$this->_em->flush();
|
||||
$this->_em->getUnitOfWork()->markReadOnly($readOnly);
|
||||
|
||||
$this->_em->clear();
|
||||
|
||||
$this->assertFalse($this->_em->getUnitOfWork()->isReadOnly($readOnly));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-1659
|
||||
*/
|
||||
public function testClearEntitiesReadOnly()
|
||||
{
|
||||
$readOnly = new ReadOnlyEntity("Test1", 1234);
|
||||
$this->_em->persist($readOnly);
|
||||
$this->_em->flush();
|
||||
$this->_em->getUnitOfWork()->markReadOnly($readOnly);
|
||||
|
||||
$this->_em->clear(get_class($readOnly));
|
||||
|
||||
$this->assertFalse($this->_em->getUnitOfWork()->isReadOnly($readOnly));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user