1

我需要在注册后禁用记录新用户的默认行为我知道这是FOSUserBundle问题,但我使用的是覆盖默认控制器的PUGXMultiUserBundle

class RegistrationUserTwoController extends Controller
{
 public function registerAction()
 {
   return $this->container
              ->get('pugx_multi_user.registration_manager')
              ->register('Acme\UserBundle\Entity\UserTwo');
  }
}

任何回应将不胜感激。

4

1 回答 1

1

尽管如此,使用 MultiUserBundle,您仍然应该覆盖默认的 FosUserBundle ,AuthenticationListener它负责在事件期间对用户进行身份验证:FOSUserEvents::REGISTRATION_COMPLETEDFOSUserEvents::REGISTRATION_CONFIRMED

该类位于此处:vendor/friendsofsymfony/user-bundle/FOS/UserBundle/EventListener/AuthenticationListener.php

您可以将此类用作您自己的侦听器的基础,并将其用作您的捆绑文件中设置您的类fos_user.listener.authentication的服务 id 。parametersservices.yml

 parameters:    
     fos_user.listener.authentication: Acme\FooBundle\Authentication\MyAuthenticationListener

如果您不熟悉服务覆盖,那么本教程将为您提供帮助:
http ://symfony.com/doc/current/cookbook/bundles/override.html#services-configuration

于 2014-06-01T08:44:30.660 回答