container = $this->getContainer(); $this->container['urlParams'] = $params; $this->container->registerMiddleware(new HttpMiddleware($this->container->query('API'))); // TODO: Remove this once sorted out. // When querying the middleware dispatcher Request gets instantiated // but urlParams isn't set yet //$this->container['urlParams'] = $params; //$this->middleware = $this->container->query('MiddlewareDispatcher'); //$this->middleware->registerMiddleware(new HttpMiddleware($this->container->query('API'))); //$this->api = $this->container->query('API'); //$this->request = $this->container->query('Request'); $this->app = new App($this->container->query('API')->getUserId()); $this->registerServices(); } public function registerServices() { $this->container->registerService('AddressBookController', function(IAppContainer $container) { return new AddressBookController($container, $this->app); }); $this->container->registerService('GroupController', function(IAppContainer $container) { return new GroupController($container, $this->app); }); $this->container->registerService('ContactController', function(IAppContainer $container) { return new ContactController($container, $this->app); }); $this->container->registerService('ContactPhotoController', function(IAppContainer $container) { return new ContactPhotoController($container, $this->app); }); $this->container->registerService('SettingsController', function(IAppContainer $container) { return new SettingsController($container, $this->app); }); $this->container->registerService('ImportController', function(IAppContainer $container) { return new ImportController($container, $this->app); }); $this->container->registerService('ExportController', function(IAppContainer $container) { return new ExportController($container, $this->app); }); } }