Skip to content

Commit 052983f

Browse files
committed
[#1775] Changing to use the new Request::isMethod() when checking for POST method
1 parent 28e1113 commit 052983f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

book/forms.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ controller::
214214
->add('dueDate', 'date')
215215
->getForm();
216216

217-
if ($request->isMethod('post')) {
217+
if ($request->isMethod('POST')) {
218218
$form->bind($request);
219219

220220
if ($form->isValid()) {
@@ -1481,7 +1481,7 @@ an array of the submitted data. This is actually really easy::
14811481
->add('message', 'textarea')
14821482
->getForm();
14831483

1484-
if ($request->getMethod() == 'POST') {
1484+
if ($request->isMethod('POST')) {
14851485
$form->bind($request);
14861486

14871487
// data is an array with "name", "email", and "message" keys

book/validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ workflow looks like the following from inside a controller::
225225
$author = new Author();
226226
$form = $this->createForm(new AuthorType(), $author);
227227

228-
if ($request->getMethod() == 'POST') {
228+
if ($request->isMethod('POST')) {
229229
$form->bind($request);
230230

231231
if ($form->isValid()) {

cookbook/doctrine/file_uploads.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ The following controller shows you how to handle the entire process::
151151
->getForm()
152152
;
153153

154-
if ($this->getRequest()->getMethod() === 'POST') {
154+
if ($this->getRequest()->isMethod('POST')) {
155155
$form->bind($this->getRequest());
156156
if ($form->isValid()) {
157157
$em = $this->getDoctrine()->getManager();

cookbook/form/form_collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ In your controller, you'll now initialize a new instance of ``TaskType``::
177177
$form = $this->createForm(new TaskType(), $task);
178178

179179
// process the form on POST
180-
if ('POST' === $request->getMethod()) {
180+
if ($request->isMethod('POST')) {
181181
$form->bind($request);
182182
if ($form->isValid()) {
183183
// maybe do some form processing, like saving the Task and Tag objects
@@ -610,7 +610,7 @@ the relationship between the removed ``Tag`` and ``Task`` object.
610610
611611
$editForm = $this->createForm(new TaskType(), $task);
612612

613-
if ('POST' === $request->getMethod()) {
613+
if ($request->isMethod('POST')) {
614614
$editForm->bind($this->getRequest());
615615

616616
if ($editForm->isValid()) {

0 commit comments

Comments
 (0)