PuGXMultiUserBundle ,相同 class 用户的多个注册表格

PuGXMultiUserBundle , multiple registration forms for same class users

我想为我的用户提供不同的 login/register pages/forms,但用户是相同的 class。我不想用额外的表填充数据库。

pugx_multi_user:
  users:
    medics:
        entity:
          class: MedAppBundle\Entity\User
        registration:
          form:
            type: MedAppBundle\Form\MedicRegistrationType
            name: app_medics_registration
            validation_groups:  [Registration, Default]
          template: MedAppBundle:Registration:registerMedic.html.twig
        profile:
          form:
            type: MedAppBundle\Form\ProfileType
            validation_groups:  [Profile, Default]
    patients:
        entity:
          class: MedAppBundle\Entity\User
        registration:
          form:
            type: MedAppBundle\Form\PatientsRegistrationType
          template: MedAppBundle:Registration:registerPacient.html.twig
        profile:
          form:
            type: MedAppBundle\Form\ProfileType
            validation_groups:  [Profile, Default]

这里是注册 class :

class RegController extends Controller
{


    public function registerPatientAction()
    {
        return $this->container
            ->get('pugx_multi_user.registration_manager')
            ->register('MedAppBundle\Entity\User');
    }


    public function registerMedicAction()
    {
        return $this->container
            ->get('pugx_multi_user.registration_manager')
            ->register('MedAppBundle\Entity\User');
    }

不幸的是,这些表格最终都变成了最后一类用户,即 pacients。此配置不起作用主要是因为 UserDiscriminator 通过 class 而不是用户类型名称获取值。

是否有任何类型的配置可以提供帮助,或者有人知道我如何实现这一点吗?

不要根据您的需要使用 PuGXMultiUserBundle 它没有意义。

只需使用 FOSUserBundle 并为您的 registration/login 模板创建额外的路由,并将它们全部设置在适当的 FOSUser-Controller-Action 上。

所以 FOS 注册操作的所有注册表格和 fos 注册操作的所有登录表格(您可以在 FOS 路由文件中查找 FOS 正在使用哪些操作 login/register)