Answer the question
In order to leave comments, you need to log in
How to fake localization for SonataClassificationBundle?
Is there a correct way to add localization to a SonataClassificationBundle? It is desirable and better if this is done using their SonataTranslationBundle bundle, but I still don’t really understand how to tie one to the other and how the translation bundle is generally used, but so far this is not the question.
At first, I made my own implementation for creating category trees using translations, but I would like not to write my own bicycles, but to use a ready-made solution from one set.
I tried to tighten up the localization using two third-party bundles ( A2LiX I18n Doctrine , A2LiX Translation Form), but with each step forward, new pitchforks came out that needed to be trampled on with a new crutch - I know from experience that this does not lead to anything good, because the crutches accumulate and it works crookedly.
I tried to attach SonataTranslationBundle to SonataClassificationBundle following the example of how to attach localization to a regular entity, but it didn't work: I took the `Category.orm.xml` config, which is "inherited" from `BaseCategory` and added a few lines there for the `name` field:
<field name="name">
<gedmo:translatable/>
</field>
[Doctrine\ORM\Mapping\MappingException]
Duplicate definition of column 'name' on entity 'Application\Sonata\ClassificationBundle\Entity\Category' in a field or discrim
inator column mapping.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question