为什么要删除FOSUserBundle中的LegacyFormHelper

Bue*_*815 2 symfony fosuserbundle

我们有一个Symofny 2.8应用程序,在服务场所,我们使用OS \ UserBundle \ Util \ LegacyFormHelper中的LegacyFormHelper。

看来,在实际的更新中该类已删除,我想知道为什么。

所以实际上,我正在寻找在FormType中使用RepeatedType的可能性,该代码类似于

->add('plainPassword', LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\RepeatedType'), array(
                    'type' => LegacyFormHelper::getType('Symfony\Component\Form\Extension\Core\Type\PasswordType'),
                    'options' => array('translation_domain' => 'FOSUserBundle'),
                    'first_options' => array('label' => 'form.password', 'attr' => array('placeholder' => 'Passwort')),
                    'second_options' => array('label' => 'form.password_confirmation'),
                    'invalid_message' => 'fos_user.password.mismatch',
                    'required' => false
                ))
Run Code Online (Sandbox Code Playgroud)

现在,我们要在没有LegacyFormHelper的情况下进行编码。

有想法吗?

问候托马斯

Bue*_*815 5

有时我可以回答我自己的问题;-)

我只是做

->add('plainPassword', RepeatedType::class, array(
                    'type' => PasswordType::class,
                    'options' => array('translation_domain' => 'FOSUserBundle'),
                    'first_options' => array('label' => 'form.password', 'attr' => array('placeholder' => 'Passwort')),
                    'second_options' => array('label' => 'form.password_confirmation'),
                    'invalid_message' => 'fos_user.password.mismatch',
                    'required' => false
                ))
Run Code Online (Sandbox Code Playgroud)

因此,如果有人对LegacyFormHelper有类似的问题,那么解决方案很容易!