I have the following form:
class AdminEmployerForm extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('firstName', 'text') ->add('user', new AdminUserForm()); } } class AdminUserForm extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('username', 'text') ->add('email', 'text'); } }
I call AdminEmployerForm in the controller and I want to remove the AdminUserForm email field from AdminEmployerForm:
$form = $this->createForm(new AdminEmployerForm, $employer);
how can i use $ form-> remove () to remove a field in an inline form? Is it possible to remove the embedded form field from the controller?
sonam source share