diff --git a/lib/Doctrine/I18n.php b/lib/Doctrine/I18n.php index 08b6a526d..e608876e4 100644 --- a/lib/Doctrine/I18n.php +++ b/lib/Doctrine/I18n.php @@ -47,6 +47,10 @@ class Doctrine_I18n extends Doctrine_Plugin public function buildDefinition(Doctrine_Table $table) { + if (empty($this->_options['fields'])) { + throw new Doctrine_I18n_Exception('Fields not set.'); + } + $this->_options['className'] = str_replace('%CLASS%', $this->_options['table']->getComponentName(), $this->_options['className']); @@ -61,7 +65,7 @@ class Doctrine_I18n extends Doctrine_Plugin $id = $table->getIdentifier(); - $options = array('className' => $className); + $options = array('className' => $this->_options['className']); $fk = array(); foreach ((array) $id as $column) { diff --git a/lib/Doctrine/I18n/Exception.php b/lib/Doctrine/I18n/Exception.php new file mode 100644 index 000000000..8fa77499f --- /dev/null +++ b/lib/Doctrine/I18n/Exception.php @@ -0,0 +1,34 @@ +. + */ + +/** + * Doctrine_I18n_Exception + * + * @package Doctrine + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + * @author Konsta Vesterinen + */ +class Doctrine_I18n_Exception extends Doctrine_Exception +{ }