Search code examples
symfonydoctrinesonata-adminsymfony-sonata

Gedmo translatable / default locale and sonata admin bundle


I am currently using the sonata admin bundle with the sonata translation bundle and gedmo translatable to localize my entities, which generally works nice. I have a category table with a field "title" which I'm localizing to a "category_translation" table. Now I can see, that the title in my default locale (en) is saved in the table "category" as well as in the table "category_translation" when I add a new item.

When I change the name of a category in the default locale, only the field in "category_translation" is updated, but the title field in "category" stays the same. The problem is that the sorting of the default locale in the repository is done by the value in the table "category", so it's wrong if the title has changed. The non-default locales work fine.

Is this behavior correct (it feels wrong) or did I forget to configure anything?


Solution

  • Ok, I solved it by adding the following options to the StoDoctrineExtensions-Bundle:

    stof_doctrine_extensions:
        translation_fallback: false
        persist_default_translation: true