我想为我的用户提供不同的登录/注册页面/表单,但用户是同一类。我不想用其他表填充数据库。
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 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按类而不是用户类型名称获取值。
是否有任何类型的配置可以帮助或是否有人知道我如何实现这一目标?