1
0
mirror of synced 2024-12-13 22:56:04 +03:00
This commit is contained in:
zYne 2007-11-13 22:05:12 +00:00
parent 68d12596ce
commit edfd9f6506

View File

@ -1164,6 +1164,31 @@ class Doctrine_Export extends Doctrine_Connection_Module
return $sql; 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 * exportPluginsSql
* exports plugin tables for given table * exports plugin tables for given table
@ -1175,13 +1200,7 @@ class Doctrine_Export extends Doctrine_Connection_Module
{ {
$sql = array(); $sql = array();
foreach ($table->getTemplates() as $name => $template) { foreach ($this->getAllPlugins($table) as $name => $plugin) {
$plugin = $template->getPlugin();
if ($plugin === null) {
continue;
}
$table = $plugin->getOption('pluginTable'); $table = $plugin->getOption('pluginTable');
// Make sure plugin has a valid table // Make sure plugin has a valid table