DoctrineExtensions icon indicating copy to clipboard operation
DoctrineExtensions copied to clipboard

Same translation for different locales not stored

Open dubitoph opened this issue 5 years ago • 2 comments

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();                            

                        }

                    }

                }
                
            }

dubitoph avatar Feb 26 '20 11:02 dubitoph

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.

wazum avatar Mar 02 '22 09:03 wazum

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.

github-actions[bot] avatar Aug 29 '22 10:08 github-actions[bot]