From 4a24202090cababa0b530c753512b871cadb2d39 Mon Sep 17 00:00:00 2001 From: Grzegorz Korba Date: Wed, 13 May 2015 12:46:22 +0200 Subject: [PATCH 1/2] Setting default format in RestRouteCollection.php only if not set already This change allows annotations set default format which won't be overriden in RestRouteLoader::load() --- Routing/RestRouteCollection.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Routing/RestRouteCollection.php b/Routing/RestRouteCollection.php index a4745bcb9..c7d0edd49 100644 --- a/Routing/RestRouteCollection.php +++ b/Routing/RestRouteCollection.php @@ -62,7 +62,10 @@ public function prependRouteControllersWithPrefix($prefix) public function setDefaultFormat($format) { foreach (parent::all() as $route) { - $route->setDefault('_format', $format); + // Set default format only if not set already (could be defined in annotation) + if(!$route->getDefault('_format')) { + $route->setDefault('_format', $format); + } } } From 785373dcf3f5930e7eeb6f14c7b4d18606826c7e Mon Sep 17 00:00:00 2001 From: Grzegorz Korba Date: Wed, 13 May 2015 13:24:39 +0200 Subject: [PATCH 2/2] Fix code formatting Added missing space, as @lsmith77 commented --- Routing/RestRouteCollection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Routing/RestRouteCollection.php b/Routing/RestRouteCollection.php index c7d0edd49..734de23a6 100644 --- a/Routing/RestRouteCollection.php +++ b/Routing/RestRouteCollection.php @@ -63,7 +63,7 @@ public function setDefaultFormat($format) { foreach (parent::all() as $route) { // Set default format only if not set already (could be defined in annotation) - if(!$route->getDefault('_format')) { + if (!$route->getDefault('_format')) { $route->setDefault('_format', $format); } }