Skip to content
Snippets Groups Projects
Commit 993fea2f authored by Thomas Müller's avatar Thomas Müller
Browse files

fix appframework routing

parent aeefe48c
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,10 @@ class App { ...@@ -44,7 +44,10 @@ class App {
* @param string $methodName the method that you want to call * @param string $methodName the method that you want to call
* @param DIContainer $container an instance of a pimple container. * @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]; $controller = $container[$controllerName];
// initialize the dispatcher and run all the middleware before the controller // initialize the dispatcher and run all the middleware before the controller
......
...@@ -37,6 +37,6 @@ class RouteActionHandler { ...@@ -37,6 +37,6 @@ class RouteActionHandler {
} }
public function __invoke($params) { public function __invoke($params) {
App::main($this->controllerName, $this->actionName, $params, $this->container); App::main($this->controllerName, $this->actionName, $this->container, $params);
} }
} }
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
namespace OCP\AppFramework; namespace OCP\AppFramework;
use OC\AppFramework\routing\RouteConfig;
/** /**
...@@ -47,6 +48,16 @@ class App { ...@@ -47,6 +48,16 @@ class App {
return $this->container; 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. * This function is called by the routing component to fire up the frameworks dispatch mechanism.
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment