Symfony2: problems rendering the translation-form

2019-07-20 01:44发布

问题:

I'm using gedmo/doctrine-translations and a2lix/translation-form-bundle: 2.*@dev to translate my entities.

The translation form always renders a Field and Content but my entity itself doesn't contain a Field or Content field.

The form type

$builder->add('translations', 'a2lix_translations');

回答1:

The 2.0 version of the TranslationFormBundle isn't compatible with the current gedmo/doctrine-extensions version.

See the bundle's upgrade notes.

You'll need to use the currently unstable branches wip-v2.4.0 and .


solution:

Either update gedmo/doctrine-extensions ...

composer require gedmo/doctrine-extensions:wip-v2.4.0@dev
composer update gedmo/doctrine-extensions

... or downgrade your a2lix/translation-form-bundle version:

composer require a2lix/translation-form-bundle:~1.2
composer update a2lix/translation-form-bundle

important notice for the 1.x version of a2lix/TranslationFormBundle:

You need to use the a2lix_translations_gedmo field-type as described in the documentation.

Further you need to specify the translatable class in the options-array like this:

$builder->add('translations', 'a2lix_translations_gedmo', array( 
    'translatable_class' => "Your\Entity" 
);