From 060e1567b6af96b13163ad322f0406fa5b424e4f Mon Sep 17 00:00:00 2001 From: HouraisanNEET <75371007+HouraisanNEET@users.noreply.github.com> Date: Fri, 9 Apr 2021 16:23:01 +0800 Subject: [PATCH 1/2] Update bootstrap.rst Fix syntax and errors. Signed-off-by: HouraisanNEET <> --- developer_manual/app_development/bootstrap.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/developer_manual/app_development/bootstrap.rst b/developer_manual/app_development/bootstrap.rst index d8f92a86b..df64e0c19 100644 --- a/developer_manual/app_development/bootstrap.rst +++ b/developer_manual/app_development/bootstrap.rst @@ -52,19 +52,24 @@ The class **must** extend ``OCP\AppFramework\App`` and may optionally implement namespace OCA\MyApp\AppInfo; use OCA\MyApp\Listeners\UserDeletedListener; - use OCA\MyApp\Notifications\Notifier; + use OCA\MyApp\Notification\Notifier; use OCP\AppFramework\App; + use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; - use OCP\Notification\IManager; + use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\User\Events; class Application extends App implements IBootstrap { + public function __construct() { + parent::__construct('myapp'); + } + public function register(IRegistrationContext $context): void { // ... registration logic goes here ... // Register the composer autoloader for packages shipped by this app, if applicable - include_once __DIR__ . '/../../vendor/autoload.php' + @include_once __DIR__ . '/../../vendor/autoload.php'; $context->registerEventListener( BeforeUserDeletedEvent::class, @@ -76,7 +81,7 @@ The class **must** extend ``OCP\AppFramework\App`` and may optionally implement // ... boot logic goes here ... /** @var IManager $manager */ - $manager = $context->getAppContainer()->query(IManager::class); + $manager = \OC::$server->getNotificationManager(); $manager->registerNotifierService(Notifier::class); } From a9a09417530b89601528ccd671c5d6b5634f0868 Mon Sep 17 00:00:00 2001 From: HouraisanNEET Date: Thu, 22 Apr 2021 22:28:44 +0800 Subject: [PATCH 2/2] Revert namespace change Signed-off-by: HouraisanNEET --- developer_manual/app_development/bootstrap.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/developer_manual/app_development/bootstrap.rst b/developer_manual/app_development/bootstrap.rst index df64e0c19..b1d13b8f8 100644 --- a/developer_manual/app_development/bootstrap.rst +++ b/developer_manual/app_development/bootstrap.rst @@ -52,11 +52,12 @@ The class **must** extend ``OCP\AppFramework\App`` and may optionally implement namespace OCA\MyApp\AppInfo; use OCA\MyApp\Listeners\UserDeletedListener; - use OCA\MyApp\Notification\Notifier; + use OCA\MyApp\Notifications\Notifier; use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; + use OCP\Notification\IManager; use OCP\User\Events; class Application extends App implements IBootstrap { @@ -69,7 +70,7 @@ The class **must** extend ``OCP\AppFramework\App`` and may optionally implement // ... registration logic goes here ... // Register the composer autoloader for packages shipped by this app, if applicable - @include_once __DIR__ . '/../../vendor/autoload.php'; + include_once __DIR__ . '/../../vendor/autoload.php'; $context->registerEventListener( BeforeUserDeletedEvent::class, @@ -81,7 +82,7 @@ The class **must** extend ``OCP\AppFramework\App`` and may optionally implement // ... boot logic goes here ... /** @var IManager $manager */ - $manager = \OC::$server->getNotificationManager(); + $manager = $context->getAppContainer()->query(IManager::class); $manager->registerNotifierService(Notifier::class); } @@ -143,6 +144,6 @@ class and query an instance like declare(strict_types=1); // Register the composer autoloader for packages shipped by this app, if applicable - @include_once __DIR__ . '/../vendor/autoload.php'; + include_once __DIR__ . '/../vendor/autoload.php'; $app = \OC::$server->query(\OCA\MyApp\AppInfo\Application::class);