merged branch lstrojny/feature/form-http-delete (PR #3159)

Commits
-------

0b7e2e0 Support for DELETE method in forms

Discussion
----------

[Form] Support DELETE HTTP verb

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: none
Todo: -

As `Symfony\Component\HttpFoundation\Request` already support DELETE requests nicely by parsing the request for us, support for the HTTPs DELETE verb can be easily done.

---------------------------------------------------------------------------

by mvrhov at 2012-01-20T06:00:49Z

This is wrong. The body for DELETE method is supposed to be empty or if present ignored.
Also the DELETE is supposed to remove the resource identified by uri, so the same code as for GET should be executed.

---------------------------------------------------------------------------

by lstrojny at 2012-01-20T08:56:22Z

I don’t think that’s the case. The HTTP standard does not state explicitly that DELETE does not have a body. See this [StackOverflow thread](http://stackoverflow.com/questions/2539394/rest-http-delete-and-parameters)
This commit is contained in:
Fabien Potencier 2012-01-22 10:05:04 +01:00
commit c7ec49c624
2 changed files with 2 additions and 0 deletions

View File

@ -581,6 +581,7 @@ class Form implements \IteratorAggregate, FormInterface
switch ($request->getMethod()) {
case 'POST':
case 'PUT':
case 'DELETE':
if ('' === $this->getName()) {
$data = array_replace_recursive(
$request->request->all(),

View File

@ -822,6 +822,7 @@ class FormTest extends \PHPUnit_Framework_TestCase
return array(
array('POST'),
array('PUT'),
array('DELETE'),
);
}