use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\Extension\Core\Type\TextType; $builder = $this->createFormBuilder() ->add('name', TextType::class); $form = $builder->getForm();
$form->setData([ 'name' => 'John Doe', ]);
$data = $form->getData();In this example, we get the data from the form. We call the getData method, which returns an array of values corresponding to the form fields. As you can see, the FormInterface is a powerful tool for managing forms in your Symfony application. By using its methods, you can easily create, set, and get form data.