diff --git a/lib/private/appframework/app.php b/lib/private/appframework/app.php index 6d3effbf1fa026b7579c2ef48e6ba77800368469..7d32403a5504f3f093d90ce094680f061d27140c 100644 --- a/lib/private/appframework/app.php +++ b/lib/private/appframework/app.php @@ -44,7 +44,10 @@ class App { * @param string $methodName the method that you want to call * @param DIContainer $container an instance of a pimple container. */ - public static function main($controllerName, $methodName, IAppContainer $container) { + public static function main($controllerName, $methodName, DIContainer $container, array $urlParams = null) { + if (!is_null($urlParams)) { + $container['urlParams'] = $urlParams; + } $controller = $container[$controllerName]; // initialize the dispatcher and run all the middleware before the controller diff --git a/lib/private/appframework/routing/routeactionhandler.php b/lib/private/appframework/routing/routeactionhandler.php index 7fb56f14eab7db7395b0bd4dcd70ed1812f32a44..2b9dc38dc438b4947844694b92607258fbbf3342 100644 --- a/lib/private/appframework/routing/routeactionhandler.php +++ b/lib/private/appframework/routing/routeactionhandler.php @@ -37,6 +37,6 @@ class RouteActionHandler { } public function __invoke($params) { - App::main($this->controllerName, $this->actionName, $params, $this->container); + App::main($this->controllerName, $this->actionName, $this->container, $params); } } diff --git a/lib/public/appframework/app.php b/lib/public/appframework/app.php index 6ac48bf102aa7c7b27296449dea9417b11704759..1f82f8da889338c2f03e1f9f8fced27638d4122a 100644 --- a/lib/public/appframework/app.php +++ b/lib/public/appframework/app.php @@ -21,6 +21,7 @@ */ namespace OCP\AppFramework; +use OC\AppFramework\routing\RouteConfig; /** @@ -47,6 +48,16 @@ class App { return $this->container; } + /** + * This function is to be called + * @param \OC_Router $router + * @param array $routes + */ + public function registerRoutes($router, $routes) { + $routeConfig = new RouteConfig($this->container, $router, $routes); + $routeConfig->register(); + } + /** * This function is called by the routing component to fire up the frameworks dispatch mechanism. *