From edfd9f6506bcb16b7fb58e4183d912b3f94cc539 Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 13 Nov 2007 22:05:12 +0000 Subject: [PATCH] --- lib/Doctrine/Export.php | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/Export.php index 3a3734225..517b063df 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/Export.php @@ -1164,6 +1164,31 @@ class Doctrine_Export extends Doctrine_Connection_Module return $sql; } + /** + * fetches all plugins recursively for given table + * + * @param Doctrine_Table $table table object to retrieve the plugins from + * @return array an array of Doctrine_Plugin objects + */ + public function getAllPlugins(Doctrine_Table $table) + { + $plugins = array(); + + foreach ($table->getTemplates() as $name => $template) { + $plugin = $template->getPlugin(); + + if ($plugin === null) { + continue; + } + + $plugins[] = $plugin; + + $plugins = array_merge($plugins, $this->getAllPlugins($plugin->getOption('pluginTable'))); + } + + return $plugins; + } + /** * exportPluginsSql * exports plugin tables for given table @@ -1175,13 +1200,7 @@ class Doctrine_Export extends Doctrine_Connection_Module { $sql = array(); - foreach ($table->getTemplates() as $name => $template) { - $plugin = $template->getPlugin(); - - if ($plugin === null) { - continue; - } - + foreach ($this->getAllPlugins($table) as $name => $plugin) { $table = $plugin->getOption('pluginTable'); // Make sure plugin has a valid table