diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php index 33253b668..9a7893eb7 100644 --- a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php +++ b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php @@ -260,6 +260,39 @@ class XmlExporter extends AbstractExporter if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval'] !== false) { $associationMappingXml->addAttribute('orphan-removal', 'true'); } + + $cascade = array(); + if ($associationMapping['isCascadeRemove']) { + $cascade[] = 'cascade-remove'; + } + + if ($associationMapping['isCascadePersist']) { + $cascade[] = 'cascade-persist'; + } + + if ($associationMapping['isCascadeRefresh']) { + $cascade[] = 'cascade-refresh'; + } + + if ($associationMapping['isCascadeMerge']) { + $cascade[] = 'cascade-merge'; + } + + if ($associationMapping['isCascadeDetach']) { + $cascade[] = 'cascade-detach'; + } + + if (count($cascade) === 5) { + $cascade = array('cascade-all'); + } + + if ($cascade) { + $cascadeXml = $associationMappingXml->addChild('cascade'); + + foreach ($cascade as $type) { + $cascadeXml->addChild($type); + } + } if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) { $joinTableXml = $associationMappingXml->addChild('join-table'); @@ -330,39 +363,6 @@ class XmlExporter extends AbstractExporter $orderByFieldXml->addAttribute('direction', $direction); } } - $cascade = array(); - - if ($associationMapping['isCascadeRemove']) { - $cascade[] = 'cascade-remove'; - } - - if ($associationMapping['isCascadePersist']) { - $cascade[] = 'cascade-persist'; - } - - if ($associationMapping['isCascadeRefresh']) { - $cascade[] = 'cascade-refresh'; - } - - if ($associationMapping['isCascadeMerge']) { - $cascade[] = 'cascade-merge'; - } - - if ($associationMapping['isCascadeDetach']) { - $cascade[] = 'cascade-detach'; - } - - if (count($cascade) === 5) { - $cascade = array('cascade-all'); - } - - if ($cascade) { - $cascadeXml = $associationMappingXml->addChild('cascade'); - - foreach ($cascade as $type) { - $cascadeXml->addChild($type); - } - } } if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks)>0) {