File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -676,7 +676,19 @@ choice is ultimately up to you.
676
676
.. note ::
677
677
678
678
The form name is automatically generated from the type class name. If you want
679
- to modify it, use the :method: `Symfony\\ Component\\ Form\\ FormFactoryInterface::createNamed ` method.
679
+ to modify it, use the :method: `Symfony\\ Component\\ Form\\ FormFactoryInterface::createNamed ` method::
680
+
681
+ // src/AppBundle/Controller/DefaultController.php
682
+ use AppBundle\Form\TaskType;
683
+
684
+ public function newAction()
685
+ {
686
+ $task = ...;
687
+ $form = $this->container->get('form.factory')->createNamed('name', TaskType::class, $task);
688
+
689
+ // ...
690
+ }
691
+
680
692
You can even suppress the name completely by setting it to an empty string.
681
693
682
694
Final Thoughts
You can’t perform that action at this time.
0 commit comments