Reuse backend as provided by the app container

This commit is contained in:
Thomas Müller 2016-01-12 14:27:50 +01:00
parent 23a8c93fd2
commit bf1a2f28c2

View file

@ -21,18 +21,12 @@
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\CardDAV\SyncService;
use OCA\DAV\Connector\Sabre\Principal;
\OC::$server->registerService('CardDAVSyncService', function() {
$userManager = \OC::$server->getUserManager();
$dbConnection = \OC::$server->getDatabaseConnection();
$principalBackend = new Principal(
$userManager
);
$backend = new CardDavBackend($dbConnection, $principalBackend);
$app = new \OCA\Dav\AppInfo\Application();
/** @var CardDavBackend */
$backend = $app->getContainer()->query('CardDavBackend');
return new SyncService($backend);
});