diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-07-16 17:08:03 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2020-07-21 20:43:18 +0200 |
commit | 91e7f12088cb87ffef5660429ece404364167978 (patch) | |
tree | baf44ebc7b240bd49eb0f6bf615cbb1ed99d13db /apps/lookup_server_connector | |
parent | e029055e766298c5852eedabf06ff42b06a50198 (diff) | |
download | nextcloud-server-91e7f12088cb87ffef5660429ece404364167978.tar.gz nextcloud-server-91e7f12088cb87ffef5660429ece404364167978.zip |
Adjust apps' code to use the ContainerInterface
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/lookup_server_connector')
-rw-r--r-- | apps/lookup_server_connector/lib/AppInfo/Application.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/apps/lookup_server_connector/lib/AppInfo/Application.php b/apps/lookup_server_connector/lib/AppInfo/Application.php index c2bb61000c1..df5ddcbab87 100644 --- a/apps/lookup_server_connector/lib/AppInfo/Application.php +++ b/apps/lookup_server_connector/lib/AppInfo/Application.php @@ -28,12 +28,15 @@ declare(strict_types=1); namespace OCA\LookupServerConnector\AppInfo; +use Closure; use OCA\LookupServerConnector\UpdateLookupServer; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IUser; +use Psr\Container\ContainerInterface; use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App implements IBootstrap { @@ -47,16 +50,20 @@ class Application extends App implements IBootstrap { } public function boot(IBootContext $context): void { - /* - * @todo move the OCP events and then move the registration to `register` - */ - $dispatcher = $context->getServerContainer()->getEventDispatcher(); - $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($context) { + $context->injectFn(Closure::fromCallable([$this, 'registerEventListeners'])); + } + + /** + * @todo move the OCP events and then move the registration to `register` + */ + private function registerEventListeners(IEventDispatcher $dispatcher, + ContainerInterface $container): void { + $dispatcher->addListener('OC\AccountManager::userUpdated', function (GenericEvent $event) use ($container) { /** @var IUser $user */ $user = $event->getSubject(); /** @var UpdateLookupServer $updateLookupServer */ - $updateLookupServer = $context->getServerContainer()->query(UpdateLookupServer::class); + $updateLookupServer = $container->get(UpdateLookupServer::class); $updateLookupServer->userUpdated($user); }); } |