From ef50d940de8eba75e72471b33ab86285a480b33b Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Wed, 8 Dec 2010 21:21:00 +0100 Subject: [PATCH] CleanUp in SchemaTool. --- lib/Doctrine/ORM/Tools/SchemaTool.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index 76685c2b7..82b3a1dbf 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -132,13 +132,6 @@ class SchemaTool $table = $schema->createTable($class->getQuotedTableName($this->_platform)); - // TODO: Remove - /**if ($class->isIdGeneratorIdentity()) { - $table->setIdGeneratorType(\Doctrine\DBAL\Schema\Table::ID_IDENTITY); - } else if ($class->isIdGeneratorSequence()) { - $table->setIdGeneratorType(\Doctrine\DBAL\Schema\Table::ID_SEQUENCE); - }*/ - $columns = array(); // table columns if ($class->isInheritanceTypeSingleTable()) { @@ -189,10 +182,6 @@ class SchemaTool $table->getColumn($class->identifier[0])->setAutoincrement(false); $pkColumns[] = $columnName; - // TODO: REMOVE - /*if ($table->isIdGeneratorIdentity()) { - $table->setIdGeneratorType(\Doctrine\DBAL\Schema\Table::ID_NONE); - }*/ // Add a FK constraint on the ID column $table->addUnnamedForeignKeyConstraint( @@ -347,6 +336,9 @@ class SchemaTool if ($class->isIdGeneratorIdentity() && $class->getIdentifierFieldNames() == array($mapping['fieldName'])) { $options['autoincrement'] = true; } + if ($class->isInheritanceTypeJoined() && $class->name != $class->rootEntityName) { + $options['autoincrement'] = false; + } if ($table->hasColumn($columnName)) { // required in some inheritance scenarios @@ -502,7 +494,7 @@ class SchemaTool */ public function dropSchema(array $classes) { - $dropSchemaSql = $this->getDropSchemaSql($classes); + $dropSchemaSql = $this->getDropSchemaSQL($classes); $conn = $this->_em->getConnection(); foreach ($dropSchemaSql as $sql) {