【问题标题】:A2Lix Translation Form in Sublime3Sublime3 中的 A2Lix 翻译表单
【发布时间】:2016-11-30 18:02:27
【问题描述】:

我正在使用 KnpDoctrineExtension 和 a2lix/translation-form-b​​undle 在 Symfony3 中开发一个多语言网站。

我遵循了 KNP 和 A2Lix 的文档:控制器和实体都可以,但是当我尝试构建和呈现表单时出现 500 错误

Could not load type "a2lix_translations"

我找到的所有示例都来自 Symfony2 中的项目,所以我想知道这是否与我使用的版本有关。

我在 app\AppKernel.php 中加载了包

new Knp\DoctrineBehaviors\Bundle\DoctrineBehaviorsBundle(),
new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(),

我在 app\config\config.yml 中添加了以下几行

a2lix_translation_form:
    locale_provider: default
    locales: [br, it, ru]
    default_locale: en
    required_locales: [br, it]
    manager_registry: doctrine
    templating: "A2lixTranslationFormBundle::default.html.twig"

感谢您的关注和帮助。

【问题讨论】:

  • 能否请人确认 a2lix 表单包与 Symfony3 一起使用?

标签: symfony doctrine-extensions a2lix-translation


【解决方案1】:

我可以确认稳定版本 2.* 可以与 KNP 教义行为包和 Symfony 3.1 一起正常工作。

查看表单包作者提供的demo

【讨论】:

    【解决方案2】:

    在 sf3 中你必须添加:

    use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
    

    然后使用这个:

    $builder->add('translations', TranslationsType::class);
    

    而不是:

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

    【讨论】:

      猜你喜欢
      • 2016-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-05
      • 1970-01-01
      • 2018-12-05
      相关资源
      最近更新 更多