I'm currently creating a website with Symfony 4 and I am creating the register/login part of it. My problem is that I have different type of users, so different entities with their own fields. There are just the email and password fields in common with all entities. So, I want to achieve just one form to register any entity. To select the user type, there is just a select field at the beginning of the form.
Moreover, I need a table for each type of user in database but the email need to be unique even between each table.
So, for now, I display the right fields calling a function with AJAX which return me the different data to create the right input. But struggle on validation at this point because I'm not using a FormBuilder.
And in the database, I have a table for all users but just with id, email, password and role and one table for each type of user with the user id(from the first table) and the remaining fields, proper to each type.
Am I on the right way or there is a better solution ? I'm a beginner in Symfony so I may miss out on an obvious solution.
Thanks