diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-07-08 20:42:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 20:42:28 +0200 |
commit | ce5cb5ac339be6c0471576b0ba310e96c1302f0a (patch) | |
tree | 0681d97f57f3541ed58a6b0e0255edfb1b6fe928 /lib | |
parent | 44f8312cd31522a256a3819b343a01c6b39e50a6 (diff) | |
parent | 3f447b9c8c52c371aee52a51dfcbeb2e91a85992 (diff) | |
download | nextcloud-server-ce5cb5ac339be6c0471576b0ba310e96c1302f0a.tar.gz nextcloud-server-ce5cb5ac339be6c0471576b0ba310e96c1302f0a.zip |
Merge pull request #21758 from nextcloud/fix/routes/defaults
Fix supporting defaults for routes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/Routing/RouteConfig.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index 9a74564b613..1921ce65128 100644 --- a/lib/private/AppFramework/Routing/RouteConfig.php +++ b/lib/private/AppFramework/Routing/RouteConfig.php @@ -141,8 +141,7 @@ class RouteConfig { $routeName = $routeNamePrefix . $this->appName . '.' . $controller . '.' . $action . $postfix; $router = $this->router->create($routeName, $url) - ->method($verb) - ->setDefault('caller', [$this->appName, $controllerName, $actionName]); + ->method($verb); // optionally register requirements for route. This is used to // tell the route parser how url parameters should be matched @@ -152,9 +151,13 @@ class RouteConfig { // optionally register defaults for route. This is used to // tell the route parser how url parameters should be default valued + $defaults = []; if (array_key_exists('defaults', $route)) { - $router->defaults($route['defaults']); + $defaults = $route['defaults']; } + + $defaults['caller'] = [$this->appName, $controllerName, $actionName]; + $router->defaults($defaults); } /** @@ -230,9 +233,10 @@ class RouteConfig { $routeName = $routeNamePrefix . $this->appName . '.' . strtolower($resource) . '.' . strtolower($method); - $this->router->create($routeName, $url) - ->method($verb) - ->setDefault('caller', [$this->appName, $controllerName, $actionName]); + $route = $this->router->create($routeName, $url) + ->method($verb); + + $route->defaults(['caller' => [$this->appName, $controllerName, $actionName]]); } } } |