mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-29 07:26:05 +00:00
injectable factory fix
This commit is contained in:
@@ -121,13 +121,26 @@ class InjectableFactory
|
||||
if ($with && array_key_exists($name, $with)) {
|
||||
$injection = $with[$name];
|
||||
} else {
|
||||
$dependencyClassName = $param->getClass();
|
||||
if (is_null($dependencyClassName)) {
|
||||
$dependencyClassName = null;
|
||||
|
||||
if ($param->getType()) {
|
||||
try {
|
||||
$dependencyClassName = $param->getClass();
|
||||
} catch (\Throwable $e) {
|
||||
$badClassName = $param->getType()->getName();
|
||||
// this trick allows to log syntax errors
|
||||
new $badClassName();
|
||||
throw new Error("InjectableFactory: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (!$dependencyClassName) {
|
||||
if ($param->isDefaultValueAvailable()) {
|
||||
$injectionList[] = $param->getDefaultValue();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$injection = $this->container->get($name);
|
||||
|
||||
if (!$injection) {
|
||||
|
||||
Reference in New Issue
Block a user