Reuse backend as provided by the app container
This commit is contained in:
parent
23a8c93fd2
commit
bf1a2f28c2
1 changed files with 3 additions and 9 deletions
|
@ -21,18 +21,12 @@
|
||||||
|
|
||||||
use OCA\DAV\CardDAV\CardDavBackend;
|
use OCA\DAV\CardDAV\CardDavBackend;
|
||||||
use OCA\DAV\CardDAV\SyncService;
|
use OCA\DAV\CardDAV\SyncService;
|
||||||
use OCA\DAV\Connector\Sabre\Principal;
|
|
||||||
|
|
||||||
\OC::$server->registerService('CardDAVSyncService', function() {
|
\OC::$server->registerService('CardDAVSyncService', function() {
|
||||||
|
|
||||||
$userManager = \OC::$server->getUserManager();
|
$app = new \OCA\Dav\AppInfo\Application();
|
||||||
$dbConnection = \OC::$server->getDatabaseConnection();
|
/** @var CardDavBackend */
|
||||||
|
$backend = $app->getContainer()->query('CardDavBackend');
|
||||||
$principalBackend = new Principal(
|
|
||||||
$userManager
|
|
||||||
);
|
|
||||||
|
|
||||||
$backend = new CardDavBackend($dbConnection, $principalBackend);
|
|
||||||
|
|
||||||
return new SyncService($backend);
|
return new SyncService($backend);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue