当我尝试使用fosuserbundle自定义注册表单时出现异常尝试从命名空间“PFE \ UserBundle \ Form \ Type”加载类“RegistrationFormType” . 您是否忘记了另一个命名空间的“use”语句? mu代码命名空间PFE \ UserBundle \ Form \ Type;使用Symfony \ Component \ Form \ FormBuilderInterface;
使用FOS \ UserBundle \ Form \ Type \ RegistrationFormType作为BaseType;
class RegistrationFormType扩展BaseType {public function buildForm(FormBuilderInterface $ builder,array $ options){parent :: buildForm($ builder,$ options); $ builder->加( 'NOM') - >加( 'prenom'); public function getName(){return'pfe_user_registration'; }}
1 回答
可能只是添加\这种方式:
另一种可能的解决方案是冲洗APC . 如果你设置了APC,它有时会产生这种神秘的错误 . 要做到这一点,只需重新启动您的Apache,Nginx或您正在使用的网络服务器 .
我希望这将有所帮助 .