1
0
mirror of synced 2025-01-08 10:07:10 +03:00

Merge pull request #896 from holtkamp/patch-2

Ensure <cascade/> elements preceed <join-columns/>
This commit is contained in:
Guilherme Blanco 2014-01-05 11:32:31 -08:00
commit b65d9e6c83

View File

@ -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) {