views:

50

answers:

1

What I'm trying to do is relatively simple but I can't find documentation.

Let's say I have a model Thing with a field label. The label field is internationalized.

How can I update all label fields from a model or an action?

(I'm using Doctrine)

+2  A: 

You didn't say which ORM you're using so I assumed Doctrine.

You can update/set internationalized fields in the following way:

$thing = new Thing();
$thing->Translation['en']->label = 'My Label';
$thing->Translation['nl']->label = 'Mijn Label';
$thing->save();

Of course if your object is already persisted you have to retrieve it first.

Read more in symfony and doctrine docs:

kuba
Yes, sorry I'm using Doctrine.This seems to work, thank you :)
Guillaume Flandre