Skip to content

Modified Form bind method to submit for PUT and DELETE HTTP methods in addition to POST. #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/Symfony/Component/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,8 +700,10 @@ public function getCsrfProvider()
/**
* Binds a request to the form
*
* If the request was a POST request, the data is submitted to the form,
* transformed and written into the form data (an object or an array).
* If the request was a POST, PUT or DELETE request, the data is submitted
* to the form, transformed and written into the form data (an object or an
* array).
*
* You can set the form data by passing it in the second parameter
* of this method or by passing it in the "data" option of the form's
* constructor.
Expand All @@ -718,8 +720,11 @@ public function bind(Request $request, $data = null)
$this->setData($data);
}

// Store the submitted data in case of a post request
if ('POST' == $request->getMethod()) {
// Store the submitted data in case of a post, put or delete request
switch ($request->getMethod()) {
case 'POST':
case 'PUT':
case 'DELETE':
$values = $request->request->get($this->getName(), array());
$files = $request->files->get($this->getName(), array());

Expand Down