From b01212e2e898bef2ad6c08e2b4289425301b9f5f Mon Sep 17 00:00:00 2001 From: jackbravo Date: Thu, 23 Aug 2007 00:57:33 +0000 Subject: [PATCH] Fixed a bug when using Templates and exporting classes using inheritance If you hada base Doctrine_Record class that implemented a Template and some classes that inherited from this one using single table inheritance, the export process failed because it tried to create several times the same table --- lib/Doctrine/Export.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/Export.php index c10e516f9..8cf3c3fcd 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/Export.php @@ -1043,7 +1043,8 @@ class Doctrine_Export extends Doctrine_Connection_Module // 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) - if ($class->isSubclassOf($parent) && ! $class->isAbstract() && method_exists($class->getName(), 'setTableDefinition')) { + if ($class->isSubclassOf($parent) && ! $class->isAbstract() && $class->hasMethod('setTableDefinition') + && $class->getMethod('setTableDefinition')->getDeclaringClass()->getName() == $class->getName()) { $record = new $name(); $table = $record->getTable(); $data = $table->getExportableFormat();