mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-01-18 07:52:21 +01:00
Register middleware as string. Refs owncloud/core#8139
This commit is contained in:
parent
08b5bf4514
commit
569b2c4a3f
@ -55,15 +55,19 @@ class Dispatcher extends MainApp {
|
||||
$this->appName = 'contacts';
|
||||
parent::__construct($this->appName, $params);
|
||||
$this->container = $this->getContainer();
|
||||
$this->container->registerMiddleware(new HttpMiddleware());
|
||||
$this->server = $this->container->getServer();
|
||||
$this->app = new App($this->container->query('API')->getUserId());
|
||||
$this->registerServices();
|
||||
$this->container->registerMiddleware('HttpMiddleware');
|
||||
}
|
||||
|
||||
public function registerServices() {
|
||||
$app = $this->app;
|
||||
|
||||
$this->container->registerService('HttpMiddleware', function($container) {
|
||||
return new HttpMiddleware();
|
||||
});
|
||||
|
||||
$this->container->registerService('PageController', function(IAppContainer $container) use($app) {
|
||||
$request = $container->query('Request');
|
||||
return new PageController($this->appName, $request);
|
||||
|
Loading…
x
Reference in New Issue
Block a user