commit 684ee4656bda6379c4c30be4869bc76d071ca381
parent b39ebc3eddf30662e946e20e236025a296153117
Author: Felicitus <felicitus@felicitus.org>
Date: Sat, 21 Dec 2013 20:10:18 +0100
Added fallback to json
Diffstat:
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/app/config/config.yml b/app/config/config.yml
@@ -13,9 +13,7 @@ fos_rest:
templating_formats:
html: false
view_response_listener: force
- format_listener:
- rules:
- - { fallback_format: 'json' }
+
sensio_framework_extra:
diff --git a/src/PartKeepr/SiPrefixBundle/Controller/DefaultController.php b/src/PartKeepr/SiPrefixBundle/Controller/DefaultController.php
@@ -9,13 +9,15 @@ use Symfony\Component\Routing\Annotation\Route;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use FOS\RestBundle\Controller\Annotations\View;
-class DefaultController extends FOSRestController {
+class DefaultController extends FOSRestController
+{
/**
- * @Route("/siprefix/get/", defaults={"method" = "get"})
+ * @Route("/siprefix/get/", defaults={"method" = "get","_format" = "json"})
* @ApiDoc(description="Retrieves all SI Prefixes in the database")
* @View()
*/
- public function getSiPrefixesAction () {
+ public function getSiPrefixesAction()
+ {
$siPrefixes = SiPrefixManager::getInstance()->getList(new ManagerFilter());
$data = array();
@@ -23,7 +25,6 @@ class DefaultController extends FOSRestController {
foreach ($siPrefixes["data"] as $siPrefix) {
$data[] = SiPrefixManager::getInstance()->getEntity($siPrefix["id"]);
}
- return $data;
+ return $data;
}
-
}
\ No newline at end of file