1
0
mirror of synced 2024-12-13 22:56:04 +03:00
This commit is contained in:
zYne 2007-09-06 20:52:36 +00:00
parent e45ae7d082
commit d16ea7d8fc

View File

@ -31,19 +31,29 @@
*/
class Doctrine_Template_I18n extends Doctrine_Template
{
protected $_i18n;
public function __construct(array $options)
{
$this->_i18n = new Doctrine_I18n($options);
$this->_plugin = new Doctrine_I18n($options);
}
public function setUp()
{
$this->_i18n->setOption('table', $this->_table);
$this->_i18n->buildDefinition($this->_table);
$this->_plugin->setOption('table', $this->_table);
$name = $this->_table->getComponentName();
$className = $this->_plugin->getOption('className');
if (strpos($className, '%CLASS%') !== false) {
$this->_plugin->setOption('className', str_replace('%CLASS%', $name, $className));
$className = $this->_plugin->getOption('className');
}
$this->_plugin->buildDefinition($this->_table);
$id = $this->_table->getIdentifier();
$this->hasMany($className . ' as Translation', array('local' => $id, 'foreign' => $id));
}
public function getI18n()
{
return $this->_i18n;
return $this->_plugin;
}
}