From f23b1a5245e33b57d64a741404a3d4fd975d700e Mon Sep 17 00:00:00 2001 From: Aeredren <57669973+Aeredren@users.noreply.github.com> Date: Fri, 8 Oct 2021 15:30:52 +0200 Subject: [PATCH] Correct value for appname variable Here $class2->appName come from $AppName which come from $app = new \OCP\AppFramework\App('myapp'); So it should be 'myapp' and not 'appname' --- developer_manual/basics/dependency_injection.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/developer_manual/basics/dependency_injection.rst b/developer_manual/basics/dependency_injection.rst index e3602dfa1..6f9a87472 100644 --- a/developer_manual/basics/dependency_injection.rst +++ b/developer_manual/basics/dependency_injection.rst @@ -214,7 +214,7 @@ So basically the following is now possible: $class2 instanceof MyTestClass2; // true $class2->class instanceof MyTestClass; // true - $class2->appName === 'appname'; // true + $class2->appName === 'myapp'; // true $class2 === $app->getContainer()->get('OCA\MyApp\MyTestClass2'); // true .. note:: $AppName is resolved because the container registered a parameter under the key 'AppName' which will return the app id. The lookup is case sensitive so while $AppName will work correctly, using $appName as a constructor parameter will fail.