在将 symfony2 与依赖项更新到 2.8 后,我在尝试覆盖奏鸣曲用户捆绑注册表单时收到以下错误消息:
The field type "Sonata\UserBundle\Form\Type\RegistrationFormType" is not registered with the service container.
如果我切换回 Symfony 2.7,一切都会再次运行。
我的服务.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' );
不幸的是,我找不到有关此主题的任何资源(即,自最新版本以来是否在覆盖注册表单方面有任何更改)