1
0
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:
Thomas Tanghus 2014-04-10 20:29:17 +02:00
parent 08b5bf4514
commit 569b2c4a3f

View File

@ -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);