Signed-off-by: Joas Schilling <coding@schilljs.com>tags/v16.0.0beta1
@@ -71,6 +71,19 @@ class ServerContainer extends SimpleContainer { | |||
$this->appContainers[strtolower(App::buildAppNamespace($appName, ''))] = $container; | |||
} | |||
/** | |||
* @param string $appName | |||
* @return DIContainer | |||
* @throws QueryException | |||
*/ | |||
public function getRegisteredAppContainer(string $appName) { | |||
if (isset($this->appContainers[strtolower(App::buildAppNamespace($appName, ''))])) { | |||
return $this->appContainers[strtolower(App::buildAppNamespace($appName, ''))]; | |||
} | |||
throw new QueryException(); | |||
} | |||
/** | |||
* @param string $namespace | |||
* @param string $sensitiveNamespace |
@@ -66,11 +66,16 @@ class App { | |||
/** | |||
* @param string $appName | |||
* @param array $urlParams an array with variables extracted from the routes | |||
* @since 6.0.0 | |||
*/ | |||
public function __construct(string $appName, array $urlParams = []) { | |||
$this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams); | |||
try { | |||
$this->container = \OC::$server->getRegisteredAppContainer($appName); | |||
} catch (QueryException $e) { | |||
$this->container = new \OC\AppFramework\DependencyInjection\DIContainer($appName, $urlParams); | |||
} | |||
} | |||
/** |