mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Clean up and deprecate app container aliases
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
87f8f9ff1d
commit
41b2466d35
1 changed files with 9 additions and 6 deletions
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue