Skip to content

Commit 4a24202

Browse files
committed
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()
1 parent ceb10f9 commit 4a24202

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Routing/RestRouteCollection.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ public function prependRouteControllersWithPrefix($prefix)
6262
public function setDefaultFormat($format)
6363
{
6464
foreach (parent::all() as $route) {
65-
$route->setDefault('_format', $format);
65+
// Set default format only if not set already (could be defined in annotation)
66+
if(!$route->getDefault('_format')) {
67+
$route->setDefault('_format', $format);
68+
}
6669
}
6770
}
6871

0 commit comments

Comments
 (0)