DoctrineExtensions
DoctrineExtensions copied to clipboard
Same translation for different locales not stored
The same translation as this of the default locale isn't stored in the database.
Examples :
- "en" => "High" and "fr" => "Haute" : 2 translations are stored
- "en" => "Top" and "fr" => "Top" : only the "en" translation is stored
Example in a Symfony controller :
foreach($seasons as $season)
{
foreach($locales as $locale)
{
if($locale)
{
$translation = $seasonsForm['season_' . $season->getId() . '_' . $locale]->getData();
if ($translation)
{
$season->setSeason($translation);
$season->setTranslatableLocale($locale);
$manager->persist($season);
$manager->flush();
}
}
}
}
I had the same problem, solved it by updating another property (like updatedAt) on the entity. Then I got my desired result with all translations (even with the same value). I guess that's an issue with the Entity Manager not recognizing that something has changed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.