Skip to content

Instantly share code, notes, and snippets.

@rande
Created July 9, 2012 18:20
Show Gist options
  • Save rande/3078019 to your computer and use it in GitHub Desktop.
Save rande/3078019 to your computer and use it in GitHub Desktop.
diff --git a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
index 2cad8a4..51c4924 100644
--- a/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
+++ b/lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php
@@ -127,6 +127,16 @@ class XmlExporter extends AbstractExporter
}
}
+ foreach ($metadata->associationMappings as $name => $field) {
+ if (isset($field['id']) && $field['id']) {
+ $id[$name] = $field;
+ $id[$name]['associationKey'] = true;
+ $id[$name]['type'] = 'string';
+
+// var_dump($field); die();
+ }
+ }
+
if ( ! $metadata->isIdentifierComposite && $idGeneratorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) {
$id[$metadata->getSingleIdentifierFieldName()]['generator']['strategy'] = $idGeneratorType;
}
@@ -163,6 +173,11 @@ class XmlExporter extends AbstractExporter
if (isset($field['precision'])) {
$fieldXml->addAttribute('precision', $field['precision']);
}
+
+ if (isset($field['nullable'])) {
+ $fieldXml->addAttribute('nullable', $field['nullable'] === true ? 'true' : 'false');
+ }
+
if (isset($field['scale'])) {
$fieldXml->addAttribute('scale', $field['scale']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment