1
0
mirror of synced 2025-01-18 22:41:43 +03:00

Applying fix for failing test for DDC-2230

This commit is contained in:
Marco Pivetta 2013-02-23 01:45:40 +01:00
parent be24439e2f
commit 350fa4f15b
2 changed files with 13 additions and 3 deletions

View File

@ -2659,7 +2659,10 @@ class UnitOfWork implements PropertyChangedListener
$this->entityIdentifiers[$newValueOid] = $associatedId;
$this->identityMap[$targetClass->rootEntityName][$relatedIdHash] = $newValue;
if ($newValue instanceof NotifyPropertyChanged) {
if (
$newValue instanceof NotifyPropertyChanged &&
( ! $newValue instanceof Proxy || $newValue->__isInitialized())
) {
$newValue->addPropertyChangedListener($this);
}
$this->entityStates[$newValueOid] = self::STATE_MANAGED;
@ -3003,7 +3006,7 @@ class UnitOfWork implements PropertyChangedListener
$this->addToIdentityMap($entity);
if ($entity instanceof NotifyPropertyChanged) {
if ($entity instanceof NotifyPropertyChanged && ( ! $entity instanceof Proxy || $entity->__isInitialized())) {
$entity->addPropertyChangedListener($this);
}
}

View File

@ -50,7 +50,14 @@ class DDC1690Test extends \Doctrine\Tests\OrmFunctionalTestCase
$child = $this->_em->find(__NAMESPACE__.'\DDC1690Child', $childId);
$this->assertEquals(1, count($parent->listeners));
$this->assertEquals(1, count($child->listeners));
$this->assertInstanceOf(
'Doctrine\\ORM\\Proxy\\Proxy',
$child,
'Verifying that $child is a proxy before using proxy API'
);
$this->assertCount(0, $child->listeners);
$child->__load();
$this->assertCount(1, $child->listeners);
unset($parent, $child);
$parent = $this->_em->find(__NAMESPACE__.'\DDC1690Parent', $parentId);