From 8e5f6fd0c9807aa1d4daa358acf023a7042c2916 Mon Sep 17 00:00:00 2001 From: Donald Tyler Date: Thu, 17 Feb 2011 07:09:09 -0800 Subject: [PATCH] Modified bind method to submit for PUT and DELETE HTTP methods in addition to POST. --- src/Symfony/Component/Form/Form.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 820772bd1bbd3..0c1b6de79905e 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -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. @@ -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());