This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.2 » doctrine i18n lang field
icon5.gif  doctrine i18n lang field [message #85623] Tue, 22 September 2009 12:05 Go to next message
diji  is currently offline diji
Messages: 2
Registered: September 2009
Junior Member
Hi,

I wasn't able to find how I can make doctrine use a field called culture instead of lang for its i18n Behavior, does anybody knows how I can achieve this ?
(The database was built using propel "conventions", so my tables have a culture field)

Thanks !

For info here's the schema
Content:
  actAs:
    I18n:
      fields: [title, description]
      className:  %CLASS%I18n
      length: 4
    Timestampable: ~
  columns:
    id:
      type: integer(4)
      primary: true
      autoincrement: true
    title: string(255)
    description: clob
Re: doctrine i18n lang field [message #85629 is a reply to message #85623 ] Tue, 22 September 2009 13:30 Go to previous messageGo to next message
diji  is currently offline diji
Messages: 2
Registered: September 2009
Junior Member
Well, looking at the documentation and the code it looks like its not possible ('lang' is hard coded). I'm wondering why the version behavior has an option called versionColumn and not the i18n? So I made one called i18Column.

For those interested here's what I've done :
added the option to the Doctrine_I18n class (Doctrine/I18n.php)
protected $_options = array(
                          'className'     => '%CLASS%Translation',
                          'i18nColumn'    => 'lang',
                          'fields'        => array(),
                          (...)                   

and edited
$this->hasColumn('lang', $this->_options['type'], $this->_options['length'], $options);
$this->bindQueryParts(array('indexBy' => 'lang'));

to
$this->hasColumn( $this->_options['i18nColumn'], $this->_options['type'], $this->_options['length'], $options);
$this->bindQueryParts(array('indexBy' => $this->_options['i18nColumn']));


so I can use in schema.yml
actAs:
  I18n:
    fields: [title, description]
    className:  %CLASS%I18n
    i18nColumn: culture
    length: 4
    options:


Re: doctrine i18n lang field [message #102548 is a reply to message #85629 ] Thu, 15 July 2010 18:29 Go to previous message
simongl  is currently offline simongl
Messages: 20
Registered: July 2008
Location: QC
Junior Member
Old post, but I had some problem upgrading symfony 1.2 to 1.4 (1.4.6) with this issue.

Version 1.4.6 uses doctrine 1.2.2. Looking at the Doctrine/I18n.php code :

protected $_options = array( 
[...]
'i18nField'     => 'lang',
[...]


Doctrine uses 'i18nField', not 'i18nColumn'. In my schema.yml, setting 'i18nField' i18n option to 'culture' worked perfectly.
Previous Topic:i18n Date validation problem
Next Topic:sfDoctrineGuardPlugin - check if browser is just closed (user doesn't logout)
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software