Author: xavier
Date: 2010-05-19 22:36:14 +0200 (Wed, 19 May 2010)
New Revision: 29536

Modified:
   plugins/sfDoctrineRestGeneratorPlugin/trunk/README
   
plugins/sfDoctrineRestGeneratorPlugin/trunk/data/generator/sfDoctrineRestGenerator/default/parts/createAction.php
   
plugins/sfDoctrineRestGeneratorPlugin/trunk/data/generator/sfDoctrineRestGenerator/default/parts/indexAction.php
Log:
[sfDoctrineRestGeneratorPlugin]: fixed one bug that would'nt permit error 
messages to be rendered correctly

Modified: plugins/sfDoctrineRestGeneratorPlugin/trunk/README
===================================================================
--- plugins/sfDoctrineRestGeneratorPlugin/trunk/README  2010-05-19 20:14:15 UTC 
(rev 29535)
+++ plugins/sfDoctrineRestGeneratorPlugin/trunk/README  2010-05-19 20:36:14 UTC 
(rev 29536)
@@ -17,7 +17,7 @@
   * serialization as XML or JSON feeds
 
 
-## How to installed
+## How to install
 
   * go to your project's root
 

Modified: 
plugins/sfDoctrineRestGeneratorPlugin/trunk/data/generator/sfDoctrineRestGenerator/default/parts/createAction.php
===================================================================
--- 
plugins/sfDoctrineRestGeneratorPlugin/trunk/data/generator/sfDoctrineRestGenerator/default/parts/createAction.php
   2010-05-19 20:14:15 UTC (rev 29535)
+++ 
plugins/sfDoctrineRestGeneratorPlugin/trunk/data/generator/sfDoctrineRestGenerator/default/parts/createAction.php
   2010-05-19 20:36:14 UTC (rev 29536)
@@ -7,6 +7,7 @@
   {
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     $content = $request->getParameter('content');
+    $request->setRequestFormat('html');
 
     try
     {
@@ -14,9 +15,18 @@
     }
     catch (Exception $e)
     {
-      $this->getResponse()->setStatusCode(406);
+      $format = $request->getParameter('sf_format');
+
+      if (!in_array($format, <?php 
var_export($this->configuration->getValue('default.formats_enabled', 
array('json', 'xml'))) ?>))
+      {
+        $format = 'xml';
+      }
+
+       $this->getResponse()->setStatusCode(406);
       $error = array(array('message' => $e->getMessage()));
-      $this->xml = sfRestInflector::arrayToXml($error, 'error');
+      $serializer = sfResourceSerializer::getInstance($format);
+      $this->getResponse()->setContentType($serializer->getContentType());
+      $this->output = $serializer->serialize($error, 'error');
       $this->setTemplate('index');
       return sfView::SUCCESS;
     }

Modified: 
plugins/sfDoctrineRestGeneratorPlugin/trunk/data/generator/sfDoctrineRestGenerator/default/parts/indexAction.php
===================================================================
--- 
plugins/sfDoctrineRestGeneratorPlugin/trunk/data/generator/sfDoctrineRestGenerator/default/parts/indexAction.php
    2010-05-19 20:14:15 UTC (rev 29535)
+++ 
plugins/sfDoctrineRestGeneratorPlugin/trunk/data/generator/sfDoctrineRestGenerator/default/parts/indexAction.php
    2010-05-19 20:36:14 UTC (rev 29536)
@@ -35,7 +35,9 @@
     {
        $this->getResponse()->setStatusCode(406);
       $error = array(array('message' => $e->getMessage()));
-      $this->xml = sfRestInflector::arrayToXml($error, 'error');
+      $serializer = sfResourceSerializer::getInstance($format);
+      $this->getResponse()->setContentType($serializer->getContentType());
+      $this->output = $serializer->serialize($error, 'error');
       return sfView::SUCCESS;
     }
 

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to