1

我正在尝试覆盖 fosuerbundle 的编辑|配置文件表单,除了在我的情况下,我使用 fosfacebookbundle 并且我们没有 facebook 用户密码,所以每次我更新它都需要密码确认。另外我不想要为了让用户有权修改他们的电子邮件、用户名,我只想让他们修改我的新表单中的其他字段,其中包含关于我、兴趣等内容。所以我来了 $builder->remove('username'); $builder->remove('email'); $builder->remove('current_password'); 现在当我按下更新时隐藏表单中的这些字段我有以下错误:

An exception has been thrown during the rendering of a template ("Notice: Array to string    conversion in path to Symfony\vendor\symfony\symfony\src\Symfony\Component\Translation\Translator.php line 154") in "FOSUserBundle:Profile:show.html.twig".

500 内部服务器错误 - Twig_Error_Runtime 1 链接异常:ErrorException »

namespace path to\Form\Type ;
use Symfony\Component\Form\FormBuilderInterface;
use FOS\UserBundle\Form\Type\ProfileFormType as BaseType;

类 Edit2FormType 扩展 BaseType {

 public function buildForm(FormBuilderInterface $builder, array $options)
 {


    parent::buildForm($builder, $options);
      $builder->add('usermoreinfos',new moreaboutmyuserType(),array('label' => 'More Info'));

    $builder->remove('username');
    $builder->remove('email');
   $builder->remove('current_password');

 }




    public function getName()
   {
   return 'nameofmy_edit_profile';
  }
}

希望你们能帮助我找到解决方案,并对我的英语不好感到抱歉。谢谢。

4

0 回答 0