我需要在注册后禁用记录新用户的默认行为 我知道这是FOSUserBundle问题,但我使用覆盖默认控制器的PUGXMultiUserBundle
class RegistrationUserTwoController extends Controller
{
public function registerAction()
{
return $this->container
->get('pugx_multi_user.registration_manager')
->register('Acme\UserBundle\Entity\UserTwo');
}
}
任何回复都将不胜感激。
答案 0 :(得分:1)
尽管使用了MultiUserBundle,您仍应覆盖在AuthenticationListener
和FOSUserEvents::REGISTRATION_COMPLETED
事件期间负责对用户进行身份验证的默认FosUserBundle FOSUserEvents::REGISTRATION_CONFIRMED
:
这个课程在这里找到: 供应商/ friendsofsymfony /用户束/ FOS / UserBundle /事件监听/ AuthenticationListener.php
您可以将此类用作您自己的监听器的基础,并使用fos_user.listener.authentication
作为您的捆绑包parameters
文件中services.yml
的服务ID设置您的班级。
parameters:
fos_user.listener.authentication: Acme\FooBundle\Authentication\MyAuthenticationListener
如果您不熟悉服务覆盖,那么本教程将帮助您:
http://symfony.com/doc/current/cookbook/bundles/override.html#services-configuration