2013-04-18 01:12:04 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Thomas Tanghus
|
|
|
|
* Copyright (c) 2013 Thomas Tanghus (thomas@tanghus.net)
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace OCA\Contacts;
|
2013-05-18 04:56:59 +02:00
|
|
|
|
2013-09-04 08:03:33 +02:00
|
|
|
use OCA\AppFramework\DependencyInjection\DIContainer as BaseContainer,
|
|
|
|
OCA\AppFramework\Middleware\MiddlewareDispatcher,
|
|
|
|
OCA\AppFramework\Middleware\Security\SecurityMiddleware,
|
|
|
|
OCA\Contacts\Middleware\Http as HttpMiddleware,
|
|
|
|
OCA\Contacts\Controller\AddressBookController,
|
|
|
|
OCA\Contacts\Controller\GroupController,
|
|
|
|
OCA\Contacts\Controller\ContactController,
|
|
|
|
OCA\Contacts\Controller\ContactPhotoController,
|
|
|
|
OCA\Contacts\Controller\SettingsController,
|
|
|
|
OCA\Contacts\Controller\ImportController;
|
2013-04-18 01:12:04 +02:00
|
|
|
|
|
|
|
class DIContainer extends BaseContainer {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define your dependencies in here
|
|
|
|
*/
|
|
|
|
public function __construct(){
|
|
|
|
// tell parent container about the app name
|
|
|
|
parent::__construct('contacts');
|
|
|
|
|
2013-05-18 04:56:59 +02:00
|
|
|
$this['HttpMiddleware'] = $this->share(function($c){
|
|
|
|
return new HttpMiddleware($c['API']);
|
|
|
|
});
|
|
|
|
|
|
|
|
$this['MiddlewareDispatcher'] = $this->share(function($c){
|
|
|
|
$dispatcher = new MiddlewareDispatcher();
|
|
|
|
$dispatcher->registerMiddleware($c['HttpMiddleware']);
|
|
|
|
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
|
|
|
|
|
|
|
|
return $dispatcher;
|
|
|
|
});
|
|
|
|
|
2013-04-18 01:12:04 +02:00
|
|
|
/**
|
|
|
|
* CONTROLLERS
|
|
|
|
*/
|
|
|
|
$this['AddressBookController'] = $this->share(function($c){
|
|
|
|
return new AddressBookController($c['API'], $c['Request']);
|
|
|
|
});
|
2013-04-19 09:59:30 +02:00
|
|
|
|
|
|
|
$this['GroupController'] = $this->share(function($c){
|
|
|
|
return new GroupController($c['API'], $c['Request']);
|
|
|
|
});
|
|
|
|
|
2013-04-24 23:56:11 +02:00
|
|
|
$this['ContactController'] = $this->share(function($c){
|
|
|
|
return new ContactController($c['API'], $c['Request']);
|
|
|
|
});
|
|
|
|
|
2013-09-04 08:03:33 +02:00
|
|
|
$this['ContactPhotoController'] = $this->share(function($c){
|
|
|
|
return new ContactPhotoController($c['API'], $c['Request']);
|
|
|
|
});
|
|
|
|
|
2013-04-25 03:56:20 +02:00
|
|
|
$this['SettingsController'] = $this->share(function($c){
|
|
|
|
return new SettingsController($c['API'], $c['Request']);
|
|
|
|
});
|
|
|
|
|
2013-05-02 20:41:26 +02:00
|
|
|
$this['ImportController'] = $this->share(function($c){
|
|
|
|
return new ImportController($c['API'], $c['Request']);
|
|
|
|
});
|
|
|
|
|
2013-04-18 01:12:04 +02:00
|
|
|
}
|
|
|
|
}
|