summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-09-22 12:23:46 +0200
committerGitHub <noreply@github.com>2016-09-22 12:23:46 +0200
commita0e62f0880bc81d3fa6e2b89acd60a01791cc381 (patch)
treef40a71fbc575887d574d2976549c542ec9117f3b /lib
parent26f1745fb97343c24a470505e921790ecba0cc3d (diff)
parent94b0315d7aee7efce13fa1bcc34acf36a724fef9 (diff)
downloadnextcloud-server-a0e62f0880bc81d3fa6e2b89acd60a01791cc381.tar.gz
nextcloud-server-a0e62f0880bc81d3fa6e2b89acd60a01791cc381.zip
Merge pull request #1455 from nextcloud/use-magic-di
Use magic DI
Diffstat (limited to 'lib')
-rw-r--r--lib/private/AppFramework/Utility/SimpleContainer.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php
index 5f637518f4d..60496ca329e 100644
--- a/lib/private/AppFramework/Utility/SimpleContainer.php
+++ b/lib/private/AppFramework/Utility/SimpleContainer.php
@@ -62,7 +62,16 @@ class SimpleContainer extends Container implements IContainer {
$resolveName = $parameterClass->name;
}
- $parameters[] = $this->query($resolveName);
+ try {
+ $parameters[] = $this->query($resolveName);
+ } catch (\Exception $e) {
+ // Service not found, use the default value when available
+ if ($parameter->isDefaultValueAvailable()) {
+ $parameters[] = $parameter->getDefaultValue();
+ } else {
+ throw $e;
+ }
+ }
}
return $class->newInstanceArgs($parameters);
}