Hi,

I'm using symfony 1.4.9 with Doctrine and I have been trying for some days
to make my internationalized models behave like the one described
here<http://www.symfony-project.org/gentle-introduction/1_4/en/13-I18n-and-L10n#chapter_13_sub_using_the_generated_i18n_objects>
Basically, what I want to be able to do is something like this:
// Article is a table with I18n behaviour
$article->getTitle() // get the title translated in the default language
$article->getTitle('fr') // get the title translated in french

For some reasons, the above does not work, and the "getTitle" method always
returns the title translated in the default language.

After having a closer look to symfony's internals, I have seen that
sfDoctrineRecord and sfDoctrineRecordI18nFilter are designed to work this
way.

So I have made a little patch to workaround this limitation.

It's really simple: in the sfDoctrineRecord class, it looks wether the
getter or the setter is called with a language argument.
If this is the case, it sets a property of the record that will be use in
the sfDoctrineRecordI18nFilter to get the correct Translation object.

I'm new to symfony so I'm not sure that this modification doesn't break
anything (although until now I haven't detected any problem).

Regards,

Jonathan

P.S.: I guess this behaviour might be related with this bug:
http://www.doctrine-project.org/jira/browse/DC-779

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Attachment: i18n_getter_setter.patch
Description: Binary data

Reply via email to