简体   繁体   English

sonata admin + a2lix + gedmo可翻译的问题

[英]issue with sonata admin + a2lix + gedmo translatable

I'm trying to use sonata admin + a2lix + gedmo translatable to translate my entities. 我正在尝试使用sonata admin + a2lix + gedmo translatable来翻译我的实体。

Unfortunately it doesn't work, because I expect to see my translatable fields in the form, while in my backend I can see this "field - content" : 不幸的是它不起作用,因为我希望在表单中看到我的可翻译字段,而在我的后端我可以看到这个“字段 - 内容”:

现场内容

I've followed this tutorials: 我已经按照这个教程:

http://a2lix.fr/bundles/translation-form/ http://a2lix.fr/bundles/translation-form/

http://www.elao.com/blog/symfony-2/doctrine-2/how-to-manage-translations-for-your-object-using-sonataadminbundle.html http://www.elao.com/blog/symfony-2/doctrine-2/how-to-manage-translations-for-your-object-using-sonataadminbundle.html

and the documentation of the bundles. 以及捆绑包的文档。

Here you can find all the code I wrote: https://gist.github.com/itxavia/8416920 在这里你可以找到我写的所有代码: https//gist.github.com/itxavia/8416920

I'm pretty sure that the translatable annotation used is good, because I've tried to use those entities with PugX (another "admin generator") and all work fine... but I need sonata admin because it has got some features that PugX doesn't have so I'd like to get this code working. 我很确定使用的可翻译注释是好的,因为我已经尝试将这些实体与PugX(另一个“管理生成器”)一起使用并且一切正常...但我需要奏鸣曲管理员,因为它有一些功能, PugX没有,所以我想让这段代码正常工作。

Do you have experience with sonata admin, a2lix and gedmo to get translatable entities? 你有使用sonata admin,a2lix和gedmo来获得可翻译实体的经验吗?

Can you please give me some hints? 你能给我一些提示吗?

Thanks a lot 非常感谢

Best regards 最好的祝福

Alright, I finally fixed it. 好吧,我终于修好了。 It seems the v2 of the a2lix/translation-form-bundle doesn't support the old gedmo strategy, you would have to use wip 2.4.0 for it to work properly, but there isn't stofDoctrineIntegration bundle yet for that, so.. To get this working, you need to use 1.* branch of the a2lix/translation-form-bundle, add this to your composer.json: 似乎a2lix / translation-form-b​​undle的v2不支持旧的gedmo策略,你必须使用wip 2.4.0才能正常工作,但是还没有stofDoctrineIntegration包,所以。要使这个工作,你需要使用a2lix / translation-form-b​​undle的1. *分支,将它添加到你的composer.json:

"a2lix/translation-form-bundle": "1.*@dev"

Then in your Sonata admin class where you would like to use translations: 然后在您希望使用翻译的Sonata管理员课程中:

$formMapper
    ->add('translations', 'a2lix_translations_gedmo', array(   // Use the old gedmo strategy
        'translatable_class' => 'Your\Translatable\Entity\Class', 
));

Took me a while to figure this out, but it works great! 我花了一段时间来弄明白这一点,但效果很好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM