Dear Devs, i'm working on a Symfony2 project with the also very fresh EXTJS4 framework. Everything pretty exciting so far. EXTJS4 brought for the first time a concept of "models" (and "stores") with its new release. "Models" communicate directly with servers through different proxies, one of them is a REST JSON proxy (POST/PUT/GET ...).
On the Symfony2 side i tried to use the form framework to validate the incoming data (which would be nice and easy): ... $form->bindRequest($request); ... This will fail because the JSON data is in the body of the request and it won't be populated to the $request property. But this will work: ... $jsonData = json_decode($request->getContent(), true); // "true" to get an associative array $form->bind($jsonData); ... So this is neither a bug nor a feature report, this is just to notify someone. Maybe this could be handled in the $form->bindRequest() method: public function bindRequest(Request $request) { // Store the bound data in case of a post request switch ($request->getMethod()) { case 'POST': case 'PUT': $jsonData = json_decode($request->getContent(), true); $data = array_replace_recursive( $request->request->get($this->getName(), array()), $request->files->get($this->getName(), array()), $jsonData ); break; case 'GET': $data = $request->query->get($this->getName(), array()); break; default: throw new FormException(sprintf('The request method "%s" is not supported', $request->getMethod())); } return $this->bind($data); } This is not for production, just a suggestion. At least it would also work the same way for REST JSON data like it works for HTML forms. Michael -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to symfony-devs@googlegroups.com To unsubscribe from this group, send email to symfony-devs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en