From bf37aead8e0eea0c4005dceb1199d28212eccfb3 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 11 Apr 2014 12:45:06 +0200 Subject: [PATCH] Inject API in AddressBookController. Refs. #460 --- lib/controller/addressbookcontroller.php | 14 +++++++++++++- lib/dispatcher.php | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/controller/addressbookcontroller.php b/lib/controller/addressbookcontroller.php index ab2735f5..17d7b0db 100644 --- a/lib/controller/addressbookcontroller.php +++ b/lib/controller/addressbookcontroller.php @@ -13,13 +13,25 @@ use OCA\Contacts\App, OCA\Contacts\JSONResponse, OCA\Contacts\Utils\JSONSerializer, OCA\Contacts\Controller, - OCP\AppFramework\Http; + OCP\AppFramework\Http, + OCP\AppFramework\IApi, + OCP\IRequest; /** * Controller class For Address Books */ class AddressBookController extends Controller { + /** + * @var \OCP\AppFramework\IApi + */ + protected $api; + + public function __construct($appName, IRequest $request, App $app, IApi $api) { + parent::__construct($appName, $request, $app); + $this->api = $api; + } + /** * @NoAdminRequired * @NoCSRFRequired diff --git a/lib/dispatcher.php b/lib/dispatcher.php index 5a0d5924..c7f6d15d 100644 --- a/lib/dispatcher.php +++ b/lib/dispatcher.php @@ -74,7 +74,8 @@ class Dispatcher extends MainApp { }); $this->container->registerService('AddressBookController', function(IAppContainer $container) use($app) { $request = $container->query('Request'); - return new AddressBookController($this->appName, $request, $app); + $api = $container->query('API'); + return new AddressBookController($this->appName, $request, $app, $api); }); $this->container->registerService('GroupController', function(IAppContainer $container) use($app) { $request = $container->query('Request');