Table name for translations

11 views
Skip to first unread message

Eugene Janusov

unread,
Apr 23, 2008, 2:14:56 PM4/23/08
to doctrine-user
I have class CompanyNG, with $this->setTableName('companies'), and all
work properly, but when I try to use translations, Doctine fails to
find "company_n_g_translation" table.

Is it possible to set table name for translations?

Jonathan Wage

unread,
Apr 28, 2008, 4:38:53 PM4/28/08
to doctri...@googlegroups.com
By default the auto generated table/model is created with this pattern: %CLASS%Translation

You can set this option on the behavior with the option named 'className'. The %CLASS% is replaced with the name of the class which includes the behavior.

So, it doesn't look to be possible to customize the table name, separate from the class name. I think we should support this in the future though. Can you create a ticket?

Thanks, Jon
--
Jonathan Wage
http://www.jwage.com
http://www.centresource.com
Message has been deleted

Eugene Janusov

unread,
Apr 30, 2008, 8:29:38 AM4/30/08
to doctrine-user
> Can you create a ticket?
Done. Ticket #1000. Wow! :-)
http://trac.phpdoctrine.org/ticket/1000

Eugene Janusov

unread,
Jun 12, 2008, 2:04:42 PM6/12/08
to doctrine-user
> So, it doesn't look to be possible to customize the table name, separate
> from the class name. I think we should support this in the future though.
> Can you create a ticket?
I've looked, how translation system works, and found that it's
possible to pass option named "tableName":

public function setUp() {
$this->actAs('I18n', array(
'fields' => array('multilingual_field'),
'tableName' => 'custom_translation_table_name'
));
}

But by default, I think, it will be more evident behavior to respect
the name of the parent table, rather than the class name. Simple way
is to add setTableName() in Doctrine_I18n class. See my patch:

http://trac.phpdoctrine.org/attachment/ticket/1000/I18n.php.patch
Reply all
Reply to author
Forward
0 new messages