From 37cec1d6905dff7a8ae9497a8648351c4734d8f2 Mon Sep 17 00:00:00 2001 From: "Jonathan.Wage" Date: Tue, 16 Oct 2007 05:39:49 +0000 Subject: [PATCH] - --- lib/Doctrine/Export/Schema.php | 26 ++------------------------ lib/Doctrine/Facade.php | 6 +++++- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/lib/Doctrine/Export/Schema.php b/lib/Doctrine/Export/Schema.php index 27966e5e9..4a2f3b488 100644 --- a/lib/Doctrine/Export/Schema.php +++ b/lib/Doctrine/Export/Schema.php @@ -48,13 +48,13 @@ class Doctrine_Export_Schema */ public function buildSchema($directory = null, $models = array()) { - $array = array(); - if ($directory) { $loadedModels = Doctrine::loadModels($directory); } else { $loadedModels = Doctrine::getLoadedModels(); } + + $array = array(); $parent = new ReflectionClass('Doctrine_Record'); @@ -67,28 +67,6 @@ class Doctrine_Export_Schema if (!empty($models) && !in_array($name, $models)) { continue; } - - $class = new ReflectionClass($name); - - // check if class is an instance of Doctrine_Record and not abstract - // class must have method setTableDefinition (to avoid non-Record subclasses like symfony's sfDoctrineRecord) - // we have to recursively iterate through the class parents just to be sure that the classes using for example - // column aggregation inheritance are properly exported to database - while ($class->isAbstract() || - ! $class->isSubclassOf($parent) || - ! $class->hasMethod('setTableDefinition') || - ( $class->hasMethod('setTableDefinition') && - $class->getMethod('setTableDefinition')->getDeclaringClass()->getName() !== $class->getName())) { - - $class = $class->getParentClass(); - if ($class === false) { - break; - } - } - - if ($class === false) { - continue; - } $record = new $name(); $recordTable = $record->getTable(); diff --git a/lib/Doctrine/Facade.php b/lib/Doctrine/Facade.php index c95be73c7..2cb214c8c 100644 --- a/lib/Doctrine/Facade.php +++ b/lib/Doctrine/Facade.php @@ -173,7 +173,11 @@ class Doctrine_Facade $export = new Doctrine_Export_Schema(); - return $export->exportSchema($yamlPath, 'yml', $directory); + $result = $export->exportSchema($yamlPath, 'yml', $directory); + + exec('rm -rf ' . $directory); + + return $result; } /** * generateModelsFromYaml