Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
Modified bind method to submit for PUT and DELETE HTTP methods in add…
…ition to POST.
  • Loading branch information
Donald Tyler committed Feb 17, 2011
commit 8e5f6fd0c9807aa1d4daa358acf023a7042c2916
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