Example of nested collection forms
TemplateType.php
class TemplateType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder ->add('name', TextType::class, [ 'label' => "Template Name", 'required' => true, 'attr' => [ 'class' => 'form-control', ], ]) ->add('sentences', CollectionType::class, [ 'entry_type' => SentenceType::class, 'entry_options' => ['label' => false], 'label' => false, 'allow_add' => true, 'allow_delete' => true, 'delete_empty' => true, 'by_reference' => false, 'prototype' => true, 'prototype_name' => '__sentence__', ]) ->add('submit', SubmitType::class, [ 'label' => 'Update', 'attr' => [ 'class' => "btn btn-sm btn-primary" ], ], ) ; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'data_class' => Template::class, 'csrf_protection' => false, ]); }