Skip to content

Commit

Permalink
Merge pull request #1036 from CoditoNet/annotation_format_overriding
Browse files Browse the repository at this point in the history
Setting default format in RestRouteCollection.php only if not set already
  • Loading branch information
lsmith77 committed May 13, 2015
2 parents ceb10f9 + 785373d commit 28853da
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Routing/RestRouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 28853da

Please sign in to comment.