Skip to content

Commit 940c8c0

Browse files
committed
Merge pull request #13 from c2is/childRemoval
Child removal
2 parents d786376 + e8735e6 commit 940c8c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Services/DataMapper/XmlMapper.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function xmlElementToEntity(array $mapping, \SimpleXMLElement $xmlElemen
100100
}
101101

102102
// If xmlKey not found in XMl Data, there's no object to create. So we return null
103-
if (!isset($description['key']['xmlKey'])) {
103+
if (!isset($keys[0])) {
104104
return null;
105105
} elseif(is_array($description['key']['xmlKey'])) {
106106
$oldObject = $em->getRepository($description['repository'])->$findFunction($keys);
@@ -143,7 +143,10 @@ private function xmlElementToEntity(array $mapping, \SimpleXMLElement $xmlElemen
143143
if ($oldElements != null) {
144144
foreach ($oldElements as $oldElement) {
145145
$$objectName->$typeDescription['clear']['removeFunction']($oldElement);
146-
//$em->remove($oldElement);
146+
if(isset($typeDescription['clear']['removeChild']) && $typeDescription['clear']['removeChild'])
147+
{
148+
$em->remove($oldElement);
149+
}
147150
}
148151
}
149152
}

0 commit comments

Comments
 (0)