diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2022-11-07 12:04:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 12:04:07 +0100 |
commit | e50f4c445d0d64d6a653c9b1ba33109721003525 (patch) | |
tree | 891309fae2083f18ea8ca57f56784993bf158fb1 /lib | |
parent | 533e1803cf2746c25ce1ead7a3cd02940716458f (diff) | |
parent | 41b2466d35dd65138c02a3a8934839742020fb92 (diff) | |
download | nextcloud-server-e50f4c445d0d64d6a653c9b1ba33109721003525.tar.gz nextcloud-server-e50f4c445d0d64d6a653c9b1ba33109721003525.zip |
Merge pull request #34929 from nextcloud/chore/deprecate-app-container-aliases
Clean up and deprecate app container parameter aliases
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/DependencyInjection/DIContainer.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index e06d5226a28..298b9f000e3 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -96,7 +96,7 @@ class DIContainer extends SimpleContainer implements IAppContainer { */ public function __construct($appName, $urlParams = [], ServerContainer $server = null) { parent::__construct(); - $this['AppName'] = $appName; + $this['appName'] = $appName; $this['urlParams'] = $urlParams; $this->registerAlias('Request', IRequest::class); @@ -109,9 +109,12 @@ class DIContainer extends SimpleContainer implements IAppContainer { $this->server->registerAppContainer($appName, $this); // aliases - $this->registerAlias('appName', 'AppName'); - $this->registerAlias('webRoot', 'WebRoot'); - $this->registerAlias('userId', 'UserId'); + /** @deprecated inject $appName */ + $this->registerAlias('AppName', 'appName'); + /** @deprecated inject $webRoot*/ + $this->registerAlias('WebRoot', 'webRoot'); + /** @deprecated inject $userId */ + $this->registerAlias('UserId', 'userId'); /** * Core services @@ -158,11 +161,11 @@ class DIContainer extends SimpleContainer implements IAppContainer { $this->registerAlias(IAppContainer::class, ContainerInterface::class); // commonly used attributes - $this->registerService('UserId', function (ContainerInterface $c) { + $this->registerService('userId', function (ContainerInterface $c) { return $c->get(IUserSession::class)->getSession()->get('user_id'); }); - $this->registerService('WebRoot', function (ContainerInterface $c) { + $this->registerService('webRoot', function (ContainerInterface $c) { return $c->get(IServerContainer::class)->getWebRoot(); }); |