自Symfony2更新至2.8后的替代登记表(SonataUserBundle)

自Symfony2更新至2.8后的替代登记表(SonataUserBundle),symfony,sonata,sonata-user-bundle,symfony-2.8,Symfony,Sonata,Sonata User Bundle,Symfony 2.8,将symfony2的依赖项更新为2.8后,我在尝试覆盖sonata用户捆绑注册表单时收到以下错误消息: The field type "Sonata\UserBundle\Form\Type\RegistrationFormType" is not registered with the service container. 如果我切换回Symfony 2.7,一切都会恢复正常 My services.yml: sonata.user.registration.form.type: c

将symfony2的依赖项更新为2.8后,我在尝试覆盖sonata用户捆绑注册表单时收到以下错误消息:

The field type "Sonata\UserBundle\Form\Type\RegistrationFormType" is not registered with the service container.
如果我切换回Symfony 2.7,一切都会恢复正常

My services.yml:

sonata.user.registration.form.type:
    class: My\Bundle\Form\Type\RegistrationFormType
    arguments: [ "%fos_user.model.user.class%" , "@service_container"]
    tags:
        - { name: form.type, alias: sonata_user_registration }
在我的控制器中,以下行触发错误:

$form = $this->container->get( 'sonata.user.registration.form' );

不幸的是,我找不到有关此主题的任何资源(即,如果自最新版本以来覆盖注册表有任何更改)

好的,这不是一个bug,而是一个新功能。您必须使用bundle中的build()和boot()方法通过FormHelper::RegisterPerformTypeMapping注册FormType。

您能给出一个代码示例吗?我也有同样的问题,不明白你的确切意思!谢谢您可以在这里找到一个代码示例:在包含要覆盖的表单类型的包之后(在应用内核中)包含包是很重要的。