mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
refactor(App): Remove registerRoutes method
Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
parent
07fa9b9311
commit
db70ff6488
2 changed files with 1 additions and 33 deletions
|
|
@ -169,7 +169,7 @@ class Router implements IRouter {
|
|||
$this->loadedApps['core'] = true;
|
||||
$this->useCollection('root');
|
||||
$this->setupRoutes($this->getAttributeRoutes('core'), 'core');
|
||||
require __DIR__ . '/../../../core/routes.php';
|
||||
$this->requireRouteFile(__DIR__ . '/../../../core/routes.php', 'core');
|
||||
|
||||
// Also add the OCS collection
|
||||
$collection = $this->getCollection('root.ocs');
|
||||
|
|
|
|||
|
|
@ -9,10 +9,7 @@ declare(strict_types=1);
|
|||
*/
|
||||
namespace OCP\AppFramework;
|
||||
|
||||
use OC\AppFramework\Routing\RouteConfig;
|
||||
use OC\Route\Router;
|
||||
use OC\ServerContainer;
|
||||
use OCP\Route\IRouter;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
|
@ -96,35 +93,6 @@ class App {
|
|||
return $this->container;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to be called to create single routes and restful routes based on the given $routes array.
|
||||
*
|
||||
* Example code in routes.php of tasks app (it will register two restful resources):
|
||||
* $routes = array(
|
||||
* 'resources' => array(
|
||||
* 'lists' => array('url' => '/tasklists'),
|
||||
* 'tasks' => array('url' => '/tasklists/{listId}/tasks')
|
||||
* )
|
||||
* );
|
||||
*
|
||||
* $a = new TasksApp();
|
||||
* $a->registerRoutes($this, $routes);
|
||||
*
|
||||
* @param \OCP\Route\IRouter $router
|
||||
* @param array $routes
|
||||
* @since 6.0.0
|
||||
* @suppress PhanAccessMethodInternal
|
||||
* @deprecated 20.0.0 Just return an array from your routes.php
|
||||
*/
|
||||
public function registerRoutes(IRouter $router, array $routes) {
|
||||
if (!($router instanceof Router)) {
|
||||
throw new \RuntimeException('Can only setup routes with real router');
|
||||
}
|
||||
|
||||
$routeConfig = new RouteConfig($this->container, $router, $routes);
|
||||
$routeConfig->register();
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called by the routing component to fire up the frameworks dispatch mechanism.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue