diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/Export.php index c4ca9afda..d6048c8f8 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/Export.php @@ -1006,22 +1006,10 @@ class Doctrine_Export extends Doctrine_Connection_Module } else { $sql[] = $query; } - - if (isset($data['options']['foreignKeys']) && is_array($data['options']['foreignKeys'])) { - $fks[$table->getTableName()] = $data['options']['foreignKeys']; - } } } - /** Not needed anymore ? createTable() now handles foreign keys + rsort($sql); - foreach ($fks as $tableName => $fk) { - foreach ($fk as $k => $definition) { - if (is_array($definition)) { - $sql[] = $this->createForeignKeySql($definition['table'], $definition); - } - } - } - */ return $sql; } /** diff --git a/tests/Export/RecordTestCase.php b/tests/Export/RecordTestCase.php index d92a7c53e..d93c1ee5b 100644 --- a/tests/Export/RecordTestCase.php +++ b/tests/Export/RecordTestCase.php @@ -89,13 +89,12 @@ class Doctrine_Export_Record_TestCase extends Doctrine_UnitTestCase public function testExportModelFromDirectory() { Doctrine::export(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files2'); - + $this->assertEqual($this->adapter->pop(), 'COMMIT'); + $this->assertEqual($this->adapter->pop(), 'ALTER TABLE cms__category_languages ADD CONSTRAINT FOREIGN KEY (category_id) REFERENCES cms__category(id) ON DELETE CASCADE'); $this->assertEqual($this->adapter->pop(), 'CREATE TABLE cms__category (id BIGINT AUTO_INCREMENT, created DATETIME, parent BIGINT, position MEDIUMINT, active BIGINT, INDEX index_parent_idx (parent), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB'); - $this->assertEqual($this->adapter->pop(), 'ALTER TABLE cms__category ADD CONSTRAINT FOREIGN KEY (category_id) REFERENCES cms__category_languages(id) ON DELETE CASCADE'); $this->assertEqual($this->adapter->pop(), 'CREATE TABLE cms__category_languages (id BIGINT AUTO_INCREMENT, name TEXT, category_id BIGINT, language_id BIGINT, INDEX index_category_idx (category_id), INDEX index_language_idx (language_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB'); $this->assertEqual($this->adapter->pop(), 'BEGIN TRANSACTION'); - } } class ForeignKeyTest extends Doctrine_Record