File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -676,7 +676,23 @@ 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
+ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
684
+
685
+ class DefaultController extends AbstractController
686
+ {
687
+ public function newAction()
688
+ {
689
+ $task = ...;
690
+ $form = $this->get('form.factory')->createNamed('name', TaskType::class, $task);
691
+
692
+ // ...
693
+ }
694
+ }
695
+
680
696
You can even suppress the name completely by setting it to an empty string.
681
697
682
698
Final Thoughts
You can’t perform that action at this time.
0 commit comments