There will be lots of ways to do this.
Simplest
the user entity class contains all the fields, you have a base form-type for user which contains only common fields for all three 'roles', then extend those for each role adding the necessary fields.
Base form type
class UserType extends AbstractType {
public function buildForm( FormBuilderInterface $builder, array $options ) {
$builder->add('username', TextType::class, []);
// etc etc
}
// ...
}
Teacher
class TeacherType extends UserType {
public function buildForm( FormBuilderInterface $builder, array $options ) {
parent::buildForm($builder, $options);
$builder->add('teaching', DateType::class, []);
// etc etc
}
// ...
}
complicated way (I would probably go this way)
use a mapped superclass User
, extend it for each 'role'. This will need some attention on the auth side (use Guard). But as I hate FOSUserBundle with a passion I'm probably biased to this solution.