From f184956d3ae3b028386760704cda1a0fe80a4dc5 Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sat, 24 Jan 2015 11:40:48 +0100 Subject: [PATCH] #1169 DDC-3343 - one-to-many extra-lazy should not delete associated values when they are removed, but just update the owning side --- .../ORM/Persisters/Collection/OneToManyPersister.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php b/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php index 9b14afde5..6687e5c5c 100644 --- a/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php +++ b/lib/Doctrine/ORM/Persisters/Collection/OneToManyPersister.php @@ -163,7 +163,14 @@ class OneToManyPersister extends AbstractCollectionPersister $mapping = $collection->getMapping(); $persister = $this->uow->getEntityPersister($mapping['targetEntity']); - return $persister->delete($element); + $targetMetadata = $this->em->getClassMetadata($mapping['targetEntity']); + + // clearing owning side value + $targetMetadata->reflFields[$mapping['mappedBy']]->setValue($element, null); + + $persister->update($element); + + return true; } /**