nested plugin functionality added
This commit is contained in:
parent
edfd9f6506
commit
8e1f157882
@ -1183,7 +1183,11 @@ class Doctrine_Export extends Doctrine_Connection_Module
|
||||
|
||||
$plugins[] = $plugin;
|
||||
|
||||
$plugins = array_merge($plugins, $this->getAllPlugins($plugin->getOption('pluginTable')));
|
||||
$pluginTable = $plugin->getOption('pluginTable');
|
||||
|
||||
if ($pluginTable instanceof Doctrine_Table) {
|
||||
$plugins = array_merge($plugins, $this->getAllPlugins($pluginTable));
|
||||
}
|
||||
}
|
||||
|
||||
return $plugins;
|
||||
|
@ -38,6 +38,7 @@ class Doctrine_I18n extends Doctrine_Plugin
|
||||
'generateFiles' => false,
|
||||
'table' => false,
|
||||
'pluginTable' => false,
|
||||
'children' => array(),
|
||||
);
|
||||
|
||||
/**
|
||||
@ -123,6 +124,8 @@ class Doctrine_I18n extends Doctrine_Plugin
|
||||
|
||||
$this->_options['pluginTable']->bindQueryPart('indexBy', 'lang');
|
||||
|
||||
$this->generateChildDefinitions();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -91,6 +91,11 @@ class Doctrine_Plugin
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addChild(Doctrine_Template $template)
|
||||
{
|
||||
$this->_options['children'][] = $template;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns all options and their associated values
|
||||
*
|
||||
@ -101,6 +106,17 @@ class Doctrine_Plugin
|
||||
return $this->_options;
|
||||
}
|
||||
|
||||
public function generateChildDefinitions()
|
||||
{
|
||||
foreach ($this->_options['children'] as $child) {
|
||||
$this->_options['pluginTable']->addTemplate(get_class($child), $child);
|
||||
|
||||
$child->setTable($this->_options['pluginTable']);
|
||||
|
||||
$child->setUp();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* generates foreign keys for the plugin table based on the owner table
|
||||
*
|
||||
|
@ -85,6 +85,14 @@ class Doctrine_Template extends Doctrine_Record_Abstract
|
||||
return $this->_invoker;
|
||||
}
|
||||
|
||||
public function addChild(Doctrine_Template $template)
|
||||
{
|
||||
$this->_plugin->addChild($template);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function getPlugin()
|
||||
{
|
||||
return $this->_plugin;
|
||||
|
@ -32,8 +32,6 @@
|
||||
*/
|
||||
class Doctrine_Template_I18n extends Doctrine_Template
|
||||
{
|
||||
protected $_translation;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
@ -44,21 +42,6 @@ class Doctrine_Template_I18n extends Doctrine_Template
|
||||
{
|
||||
$this->_plugin = new Doctrine_I18n($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* translation
|
||||
*
|
||||
* sets or retrieves the current translation language
|
||||
*
|
||||
* @return Doctrine_Record this object
|
||||
*/
|
||||
public function translation($language = null)
|
||||
{
|
||||
$this->_translation = $language;
|
||||
|
||||
return $this->_translation;
|
||||
}
|
||||
|
||||
/**
|
||||
* setUp
|
||||
*
|
||||
|
@ -35,8 +35,6 @@ class Doctrine_Template_Searchable extends Doctrine_Template
|
||||
public function __construct(array $options)
|
||||
{
|
||||
$this->_plugin = new Doctrine_Search($options);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function getPlugin()
|
||||
|
@ -47,4 +47,5 @@ class Doctrine_Template_Versionable extends Doctrine_Template
|
||||
{
|
||||
return $this->_plugin;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user