Merge pull request #196 from goetas/manyidx
Added some improvments for generated XML
This commit is contained in:
commit
359a9c015b
@ -95,7 +95,10 @@ class XmlExporter extends AbstractExporter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$root->addChild('change-tracking-policy', $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy));
|
$trackingPolicy = $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy);
|
||||||
|
if ( $trackingPolicy != 'DEFERRED_IMPLICIT') {
|
||||||
|
$root->addChild('change-tracking-policy', $trackingPolicy);
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($metadata->table['indexes'])) {
|
if (isset($metadata->table['indexes'])) {
|
||||||
$indexesXml = $root->addChild('indexes');
|
$indexesXml = $root->addChild('indexes');
|
||||||
@ -183,7 +186,17 @@ class XmlExporter extends AbstractExporter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$orderMap = array(
|
||||||
|
ClassMetadataInfo::ONE_TO_ONE,
|
||||||
|
ClassMetadataInfo::ONE_TO_MANY,
|
||||||
|
ClassMetadataInfo::MANY_TO_ONE,
|
||||||
|
ClassMetadataInfo::MANY_TO_MANY,
|
||||||
|
);
|
||||||
|
uasort($metadata->associationMappings, function($m1, $m2)use(&$orderMap){
|
||||||
|
$a1 = array_search($m1['type'],$orderMap);
|
||||||
|
$a2 = array_search($m2['type'],$orderMap);
|
||||||
|
return strcmp($a1, $a2);
|
||||||
|
});
|
||||||
foreach ($metadata->associationMappings as $name => $associationMapping) {
|
foreach ($metadata->associationMappings as $name => $associationMapping) {
|
||||||
if ($associationMapping['type'] == ClassMetadataInfo::ONE_TO_ONE) {
|
if ($associationMapping['type'] == ClassMetadataInfo::ONE_TO_ONE) {
|
||||||
$associationMappingXml = $root->addChild('one-to-one');
|
$associationMappingXml = $root->addChild('one-to-one');
|
||||||
@ -204,8 +217,11 @@ class XmlExporter extends AbstractExporter
|
|||||||
if (isset($associationMapping['inversedBy'])) {
|
if (isset($associationMapping['inversedBy'])) {
|
||||||
$associationMappingXml->addAttribute('inversed-by', $associationMapping['inversedBy']);
|
$associationMappingXml->addAttribute('inversed-by', $associationMapping['inversedBy']);
|
||||||
}
|
}
|
||||||
if (isset($associationMapping['orphanRemoval'])) {
|
if (isset($associationMapping['indexBy'])) {
|
||||||
$associationMappingXml->addAttribute('orphan-removal', $associationMapping['orphanRemoval']);
|
$associationMappingXml->addAttribute('index-by', $associationMapping['indexBy']);
|
||||||
|
}
|
||||||
|
if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']!==false) {
|
||||||
|
$associationMappingXml->addAttribute('orphan-removal', 'true');
|
||||||
}
|
}
|
||||||
if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) {
|
if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) {
|
||||||
$joinTableXml = $associationMappingXml->addChild('join-table');
|
$joinTableXml = $associationMappingXml->addChild('join-table');
|
||||||
@ -290,7 +306,7 @@ class XmlExporter extends AbstractExporter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($metadata->lifecycleCallbacks)) {
|
if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks)>0) {
|
||||||
$lifecycleCallbacksXml = $root->addChild('lifecycle-callbacks');
|
$lifecycleCallbacksXml = $root->addChild('lifecycle-callbacks');
|
||||||
foreach ($metadata->lifecycleCallbacks as $name => $methods) {
|
foreach ($metadata->lifecycleCallbacks as $name => $methods) {
|
||||||
foreach ($methods as $method) {
|
foreach ($methods as $method) {
|
||||||
|
Loading…
Reference in New Issue
Block a user