@@ -70,11 +70,19 @@ Request Handling
70
70
The ``handleRequest() `` method was added in Symfony 2.3.
71
71
72
72
To process form data, you'll need to call the :method: `Symfony\\ Component\\ Form\\ Form::handleRequest `
73
- method.
73
+ method::
74
74
75
- To optionally integrate the HttpFoundation component, add the
76
- :class: `Symfony\\ Component\\ Form\\ Extension\\ HttpFoundation\\ HttpFoundationExtension `
77
- to your form factory::
75
+ $form->handleRequest();
76
+
77
+ Behind the scenes, this uses a :class: `Symfony\\ Component\\ Form\\ NativeRequestHandler `
78
+ object to read data off of the correct PHP superglobals (i.e. ``$_POST `` or
79
+ ``$_GET ``) based on the HTTP method configured on the form (POST is default).
80
+
81
+ .. sidebar :: Integration with the HttpFoundation Component
82
+
83
+ If you use the HttpFoundation component, then you should add the
84
+ :class: `Symfony\\ Component\\ Form\\ Extension\\ HttpFoundation\\ HttpFoundationExtension `
85
+ to your form factory::
78
86
79
87
use Symfony\C omponent\F orm\F orms;
80
88
use Symfony\C omponent\F orm\E xtension\H ttpFoundation\H ttpFoundationExtension;
@@ -83,13 +91,15 @@ to your form factory::
83
91
->addExtension(new HttpFoundationExtension())
84
92
->getFormFactory();
85
93
86
- Now, when you process a form, you can pass the :class: `Symfony\\ Component\\ HttpFoundation\\ Request `
87
- object to :method: `Symfony\\ Component\\ Form\\ Form::handleRequest `.
94
+ Now, when you process a form, you can pass the :class: `Symfony\\ Component\\ HttpFoundation\\ Request `
95
+ object to :method: `Symfony\\ Component\\ Form\\ Form::handleRequest `::
88
96
89
- .. note ::
97
+ $form->handleRequest($request);
98
+
99
+ .. note ::
90
100
91
- For more information about the HttpFoundation component or how to
92
- install it, see :doc: `/components/http_foundation/introduction `.
101
+ For more information about the HttpFoundation component or how to
102
+ install it, see :doc: `/components/http_foundation/introduction `.
93
103
94
104
CSRF Protection
95
105
~~~~~~~~~~~~~~~
0 commit comments