Luciano Andrade 7 年 前
コミット
ae862c7c7f
1 ファイル変更4 行追加4 行削除
  1. 4 4
      Controller/RESTController.php

+ 4 - 4
Controller/RESTController.php

@@ -233,6 +233,7 @@ abstract class RESTController extends VoryxController
         $form = $this->createForm($this->getFormEntityType(), $entity, array("method" => $request->getMethod()));
         $this->removeExtraFields($request, $form);
         $form->handleRequest($request);
+        $form->submit($request->request->get($form->getName()));
         if ($form->isValid()) {
             $em = $this->getDoctrine()->getManager();
             $em->persist($entity);
@@ -271,16 +272,15 @@ abstract class RESTController extends VoryxController
             // agrego el handler
             $form->handleRequest($request);
             // valido el formulario
-            if ($form->isValid()) {
+            $form->submit($request->request->get($form->getName()));
+            if($form->isValid()) {
                 // actualizo los datos.
                 $em->flush();
                 return $entity;
-            } else {
-                var_dump($this->getFormFieldError($form));
             }
             return FOSView::create(array('errors' => $form->getErrors()), Codes::HTTP_INTERNAL_SERVER_ERROR);
         } catch (\Exception $e) {
-            return FOSView::create($e->getMessage(), Codes::HTTP_INTERNAL_SERVER_ERROR);
+            return FOSView::create($e->getTraceAsString(), Codes::HTTP_INTERNAL_SERVER_ERROR);
         }
     }