Troubleshooting why this does not work and I cleaned up the code.
This commit is contained in:
parent
231b42eb67
commit
3e31860edd
@ -40,18 +40,28 @@ class Doctrine_I18n extends Doctrine_Plugin
|
||||
'pluginTable' => false,
|
||||
);
|
||||
|
||||
protected $_auditTable;
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* @param string $options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($options)
|
||||
{
|
||||
$this->_options = array_merge($this->_options, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* buildDefinition
|
||||
*
|
||||
* @param object $Doctrine_Table
|
||||
* @return void
|
||||
*/
|
||||
public function buildDefinition(Doctrine_Table $table)
|
||||
{
|
||||
if (empty($this->_options['fields'])) {
|
||||
throw new Doctrine_I18n_Exception('Fields not set.');
|
||||
}
|
||||
if (empty($this->_options['fields'])) {
|
||||
throw new Doctrine_I18n_Exception('Fields not set.');
|
||||
}
|
||||
|
||||
$this->_options['className'] = str_replace('%CLASS%',
|
||||
$this->_options['table']->getComponentName(),
|
||||
@ -115,4 +125,4 @@ class Doctrine_I18n extends Doctrine_Plugin
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -169,15 +169,15 @@ class Doctrine_Plugin
|
||||
if ($this->_options['generateFiles']) {
|
||||
if (isset($this->_options['generatePath']) && $this->_options['generatePath']) {
|
||||
$builder->setTargetPath($this->_options['generatePath']);
|
||||
|
||||
|
||||
$builder->buildRecord($options, $columns, $relations);
|
||||
} else {
|
||||
throw new Doctrine_Plugin_Exception('If you wish to generate files then you must specify the path to generate the files in.');
|
||||
}
|
||||
} else {
|
||||
$def = $builder->buildDefinition($options, $columns, $relations);
|
||||
|
||||
|
||||
eval($def);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -34,7 +34,12 @@ class Doctrine_Template_I18n extends Doctrine_Template
|
||||
{
|
||||
protected $_translation;
|
||||
|
||||
|
||||
/**
|
||||
* __construct
|
||||
*
|
||||
* @param string $array
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(array $options)
|
||||
{
|
||||
$this->_plugin = new Doctrine_I18n($options);
|
||||
@ -42,6 +47,7 @@ class Doctrine_Template_I18n extends Doctrine_Template
|
||||
|
||||
/**
|
||||
* translation
|
||||
*
|
||||
* sets or retrieves the current translation language
|
||||
*
|
||||
* @return Doctrine_Record this object
|
||||
@ -49,7 +55,15 @@ class Doctrine_Template_I18n extends Doctrine_Template
|
||||
public function translation($language = null)
|
||||
{
|
||||
$this->_translation = $language;
|
||||
|
||||
return $this->_translation;
|
||||
}
|
||||
|
||||
/**
|
||||
* setUp
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp()
|
||||
{
|
||||
$this->_plugin->setOption('table', $this->_table);
|
||||
@ -67,6 +81,12 @@ class Doctrine_Template_I18n extends Doctrine_Template
|
||||
|
||||
$this->hasMany($className . ' as Translation', array('local' => $id, 'foreign' => $id));
|
||||
}
|
||||
|
||||
/**
|
||||
* getI18n
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getI18n()
|
||||
{
|
||||
return $this->_plugin;
|
||||
|
Loading…
x
Reference in New Issue
Block a user