1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

[2.0][DDC-265] Partial support to inheritanceType in AnnotationExporter. Still needs to add the discriminator column.

This commit is contained in:
guilhermeblanco 2010-03-01 04:27:17 +00:00
parent a56689be67
commit de29fa97f0
2 changed files with 24 additions and 0 deletions

View file

@ -297,6 +297,29 @@ class AnnotationExporter extends AbstractExporter
return '@Table(' . implode(', ', $table) . ')';
}
private function _getInheritanceAnnotation($metadata)
{
if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) {
switch ($metadata->inheritanceType) {
case ClassMetadataInfo::INHERITANCE_TYPE_JOINED:
$type = "JOINED";
break;
case ClassMetadataInfo::INHERITANCE_TYPE_SINGLE_TABLE:
$type = "SINGLE_TABLE";
break;
case ClassMetadataInfo::INHERITANCE_TYPE_TABLE_PER_CLASS:
$type = "TABLE_PER_CLASS";
break;
}
return '@InheritanceType("'.$type.'")';
}
return '';
}
private function _getJoinColumnAnnotation(array $joinColumn)
{
$joinColumnAnnot = array();

View file

@ -16,6 +16,7 @@ use <?php echo $this->_getClassToExtendNamespace() ?>;
* @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; ?>