Skip to content

Instantly share code, notes, and snippets.

@doctrinebot
Created December 13, 2015 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doctrinebot/b88180e486c64d3b1467 to your computer and use it in GitHub Desktop.
Save doctrinebot/b88180e486c64d3b1467 to your computer and use it in GitHub Desktop.
Attachments to Doctrine Jira Issue DDC-256 - https://github.com/doctrine/doctrine2/issues/3286
Index: library/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php
===================================================================
--- library/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php (revision 6870)
+++ library/Doctrine/ORM/Tools/Export/Driver/AnnotationExporter.php (working copy)
@@ -296,6 +296,26 @@
}
return '@Table(' . implode(', ', $table) . ')';
}
+
+ private function _getInheritanceAnnotation($metadata)
+ {
+ $return = "";
+ if ($metadata->inheritanceType != 1) {
+ switch ($metadata->inheritanceType) {
+ case 2:
+ $type = "JOINED";
+ break;
+ case 3:
+ $type = "SINGLE_TABLE";
+ break;
+ case 4:
+ $type = "TABLE_PER_CLASS";
+ break;
+ }
+ $return = '@InheritanceType("'.$type.'")';
+ }
+ return $return;
+ }
private function _getJoinColumnAnnotation(array $joinColumn)
{
Index: library/Doctrine/ORM/Tools/Export/Driver/annotation.tpl.php
===================================================================
--- library/Doctrine/ORM/Tools/Export/Driver/annotation.tpl.php (revision 6870)
+++ library/Doctrine/ORM/Tools/Export/Driver/annotation.tpl.php (working copy)
@@ -16,6 +16,7 @@
* @Entity
<?php endif; ?>
* <?php echo $this->_getTableAnnotation($metadata)."\n" ?>
+ * <?php echo $this->_getInheritanceAnnotation($metadata)."\n" ?>
*/
class <?Php echo $this->_getClassName($metadata) ?><?php if ($this->_extendsClass()): ?> extends <?php echo $this->_getClassToExtendName() ?><?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment