diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2022-11-03 16:03:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-03 16:03:21 +0300 |
commit | cd6f419a63e834d6319a3989fc0ae6e56ccc9384 (patch) | |
tree | 16a6a30233f74176060ebc77eb206f3fa4fb2522 | |
parent | 51f7a3b908368942d65ee4c0324db5cf33aa97fc (diff) | |
parent | 4a04e383ec50f64a405046a1ca15b02c1ae14162 (diff) |
Merge pull request #9281 from nextcloud/enhancement/update-di-container-parameters-aliases-services
Update DI parameters, aliases and services documentation
-rw-r--r-- | developer_manual/basics/dependency_injection.rst | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/developer_manual/basics/dependency_injection.rst b/developer_manual/basics/dependency_injection.rst index d3efaf34f..163763210 100644 --- a/developer_manual/basics/dependency_injection.rst +++ b/developer_manual/basics/dependency_injection.rst @@ -310,45 +310,52 @@ The following parameter names and type hints can be used to inject core services Parameters: * **AppName**: The app id -* **WebRoot**: The path to the Nextcloud installation * **UserId**: The id of the current user +* **WebRoot**: The path to the Nextcloud installation + +Aliases: +* **appName**: resolves to ``AppName`` +* **Request**: resolves to ``\OCP\\IRequest`` +* **ServerContainer**: resolves to ``\OCP\IServerContainer`` +* **userId**: resolves to ``UserId`` +* **webRoot**: resolves to ``WebRoot`` Types: -* **OCP\\IAppConfig** -* **OCP\\IAppManager** -* **OCP\\IAvatarManager** -* **OCP\\Activity\\IManager** -* **OCP\\ICache** -* **OCP\\ICacheFactory** -* **OCP\\IConfig** -* **OCP\\AppFramework\\Utility\\IControllerMethodReflector** -* **OCP\\Contacts\\IManager** -* **OCP\\IDateTimeZone** -* **OCP\\IDBConnection** -* **OCP\\Diagnostics\\IEventLogger** -* **OCP\\Diagnostics\\IQueryLogger** -* **OCP\\Files\\Config\\IMountProviderCollection** -* **OCP\\Files\\IRootFolder** -* **OCP\\IGroupManager** -* **OCP\\IL10N** -* **OCP\\ILogger** -* **OCP\\BackgroundJob\\IJobList** -* **OCP\\INavigationManager** -* **OCP\\IPreview** -* **OCP\\IRequest** -* **OCP\\AppFramework\\Utility\\ITimeFactory** -* **OCP\\ITagManager** -* **OCP\\ITempManager** -* **OCP\\Route\\IRouter** -* **OCP\\ISearch** -* **OCP\\ISearch** -* **OCP\\Security\\ICrypto** -* **OCP\\Security\\IHasher** -* **OCP\\Security\\ISecureRandom** -* **OCP\\IURLGenerator** -* **OCP\\IUserManager** -* **OCP\\IUserSession** +* ``\OCP\IAppConfig`` +* ``\OCP\IAppManager`` +* ``\OCP\IAvatarManager`` +* ``\OCP\Activity\IManager`` +* ``\OCP\ICache`` +* ``\OCP\ICacheFactory`` +* ``\OCP\IConfig`` +* ``\OCP\AppFramework\Utility\IControllerMethodReflector`` +* ``\OCP\Contacts\IManager`` +* ``\OCP\IDateTimeZone`` +* ``\OCP\IDBConnection`` +* ``\OCP\Diagnostics\IEventLogger`` +* ``\OCP\Diagnostics\IQueryLogger`` +* ``\OCP\Files\Config\IMountProviderCollection`` +* ``\OCP\Files\IRootFolder`` +* ``\OCP\IGroupManager`` +* ``\OCP\IL10N`` +* ``\OCP\ILogger`` +* ``\OCP\BackgroundJob\IJobList`` +* ``\OCP\INavigationManager`` +* ``\OCP\IPreview`` +* ``\OCP\IRequest`` +* ``\OCP\AppFramework\Utility\ITimeFactory`` +* ``\OCP\ITagManager`` +* ``\OCP\ITempManager`` +* ``\OCP\Route\IRouter`` +* ``\OCP\ISearch`` +* ``\OCP\ISearch`` +* ``\OCP\Security\ICrypto`` +* ``\OCP\Security\IHasher`` +* ``\OCP\Security\ISecureRandom`` +* ``\OCP\IURLGenerator`` +* ``\OCP\IUserManager`` +* ``\OCP\IUserSession`` How to enable it ^^^^^^^^^^^^^^^^ @@ -396,7 +403,7 @@ What not to inject: Accessing the container from anywhere ------------------------------------- +------------------------------------- Sometimes it can be hard to inject some service inside legacy code, in these case you can use :code:`OCP\Server::get(MyService::class)`. This should only be used in |