File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
Classes/Sandstorm/GedmoTranslatableConnector Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -190,12 +190,14 @@ public function setTranslations(array $translations) {
190190 $ repository = $ this ->entityManager ->getRepository ('Gedmo \\Translatable \\Entity \\Translation ' );
191191
192192 foreach ($ translations as $ language => $ properties ) {
193- foreach ($ properties as $ propertyName => $ translatedValue ) {
193+ $ meta = $ this ->entityManager ->getClassMetadata (get_class ($ this ));
194+ // $locale class property overwrites the translatable listener (for some reasons, this is not always the same)
195+ $ locale = $ this ->locale ?? $ this ->translatableListener ->getTranslatableLocale ($ this , $ meta , $ this ->entityManager );
196+ foreach ($ properties as $ propertyName => $ translatedValue ) {
194197 /* Do not store empty translations since gedmo extension's behaviour has changed in
195198 https://github.com/Atlantic18/DoctrineExtensions/commit/6cc9fb3864a2562806d8a66276196825e3181c49 */
196199 if ($ translatedValue ) {
197- $ meta = $ this ->entityManager ->getClassMetadata (get_class ($ this ));
198- if ($ language === $ this ->translatableListener ->getTranslatableLocale ($ this , $ meta , $ this ->entityManager )) {
200+ if ($ language === $ locale ) {
199201 /* Do not translate the default language by the repository. The repository->translate() does the
200202 same, but also persists the object ($this). However, persisting the object should not be handled
201203 withing this setter.
Original file line number Diff line number Diff line change @@ -8,9 +8,9 @@ Sandstorm:
88Neos :
99 Flow :
1010 object :
11- excludeClasses :
11+ includeClasses :
1212 gedmo.doctrineextensions :
13- - ' Gedmo\\.* '
13+ - ' Gedmo\\Translatable\\Entity '
1414 persistence :
1515 doctrine :
1616 eventListeners :
You can’t perform that action at this time.
0 commit comments