I'm building Symfony 2 app with two languages i have implement the Translatable from StofDoctrineExtensionsBundle. The Translatable make other table ext_translations and store the translations.
Here is the table which i will use to translate (Objects table):
Here is the table ext_translations (ext_translations table):
When i run the code to save the translation for some reason in the ext_translations table.
$entity = $em->getRepository('ObjectsBundle:Object')->find(1);
$entity->setTitle('my title in ru');
$entity->setTranslatableLocale('ru'); // change locale
$em->persist($entity);
$em->flush();
On creation it write the title in the object table but later on update it is updating only the ext_translations table.
How is handle the update and creation in symfony 2 with two languages?
Do I need to make a copy of those inputs and store them in one time submit. For example in the Object table i have title do I need to have :
<input type="text" name="title_bg">
<input type="text" name="title_en">
And when they are submitted change the parameter local:
$entity->setTranslatableLocale('ru'); -- or what lang parameter we have
And then submit whit the upper code. What is the best solution for this kind of applications?