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])) {
|
if (isset($this->identityMap[$className][$idHash])) {
|
||||||
unset($this->identityMap[$className][$idHash]);
|
unset($this->identityMap[$className][$idHash]);
|
||||||
|
unset($this->readOnlyObjects[$oid]);
|
||||||
|
|
||||||
//$this->entityStates[$oid] = self::STATE_DETACHED;
|
//$this->entityStates[$oid] = self::STATE_DETACHED;
|
||||||
|
|
||||||
@ -2209,6 +2210,7 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
$this->collectionDeletions =
|
$this->collectionDeletions =
|
||||||
$this->collectionUpdates =
|
$this->collectionUpdates =
|
||||||
$this->extraUpdates =
|
$this->extraUpdates =
|
||||||
|
$this->readOnlyObjects =
|
||||||
$this->orphanRemovals = array();
|
$this->orphanRemovals = array();
|
||||||
|
|
||||||
if ($this->commitOrderCalculator !== null) {
|
if ($this->commitOrderCalculator !== null) {
|
||||||
|
@ -15,9 +15,12 @@ class ReadOnlyTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->_schemaTool->createSchema(array(
|
try {
|
||||||
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\ReadOnlyEntity'),
|
$this->_schemaTool->createSchema(array(
|
||||||
));
|
$this->_em->getClassMetadata('Doctrine\Tests\ORM\Functional\ReadOnlyEntity'),
|
||||||
|
));
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReadOnlyEntityNeverChangeTracked()
|
public function testReadOnlyEntityNeverChangeTracked()
|
||||||
@ -36,6 +39,36 @@ class ReadOnlyTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->assertEquals("Test1", $dbReadOnly->name);
|
$this->assertEquals("Test1", $dbReadOnly->name);
|
||||||
$this->assertEquals(1234, $dbReadOnly->numericValue);
|
$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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,4 +91,4 @@ class ReadOnlyEntity
|
|||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->numericValue = $number;
|
$this->numericValue = $number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user