Merge pull request #896 from holtkamp/patch-2
Ensure <cascade/> elements preceed <join-columns/>
This commit is contained in:
commit
b65d9e6c83
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user