1
0
mirror of synced 2025-02-06 23:39:25 +03:00

[DDC-1050] Change refresh of collection back

This commit is contained in:
Benjamin Eberlei 2011-03-06 21:49:02 +01:00
parent 851f44a066
commit 112f9d1480

View File

@ -1978,27 +1978,18 @@ class UnitOfWork implements PropertyChangedListener
->loadOneToOneEntity($assoc, $entity, null)); ->loadOneToOneEntity($assoc, $entity, null));
} }
} else { } else {
// Inject collection
$pColl = new PersistentCollection($this->em, $targetClass, new ArrayCollection);
$pColl->setOwner($entity, $assoc);
if (isset($hints[Query::HINT_REFRESH])) { $reflField = $class->reflFields[$field];
$pColl = $this->_class->reflFields[$field]->getValue($entity); $reflField->setValue($entity, $pColl);
$pColl->setInitialized(false);
// no matter if dirty or non-dirty entities are already loaded, smoke them out! if ($assoc['fetch'] == ClassMetadata::FETCH_EAGER) {
// the beauty of it being, they are still in the identity map $this->loadCollection($pColl);
$pColl->unwrap()->clear(); $pColl->takeSnapshot();
} else { } else {
// Inject collection $pColl->setInitialized(false);
$pColl = new PersistentCollection($this->em, $targetClass, new ArrayCollection);
$pColl->setOwner($entity, $assoc);
$reflField = $class->reflFields[$field];
$reflField->setValue($entity, $pColl);
if ($assoc['fetch'] == ClassMetadata::FETCH_EAGER) {
$this->loadCollection($pColl);
$pColl->takeSnapshot();
} else {
$pColl->setInitialized(false);
}
} }
$this->originalEntityData[$oid][$field] = $pColl; $this->originalEntityData[$oid][$field] = $pColl;
} }