diff --git a/composer.json b/composer.json index 4627a25..7f3a47c 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ }, "require": { "php": "^7.1", - "nette/di": "^3.0", + "nette/di": "^3.0.2", "nette/application": "^3.0", "nette/reflection": "^2.4.2", "tracy/tracy": "^2.6" diff --git a/src/Kdyby/Autowired/AutowireComponentFactories.php b/src/Kdyby/Autowired/AutowireComponentFactories.php index c670999..e21a64b 100644 --- a/src/Kdyby/Autowired/AutowireComponentFactories.php +++ b/src/Kdyby/Autowired/AutowireComponentFactories.php @@ -114,7 +114,9 @@ private function findByTypeForFactory(string $type) */ protected function createComponent(string $name): ?IComponent { - $sl = $this->getComponentFactoriesLocator(); + $getter = function (string $type) { + return $this->getComponentFactoriesLocator()->getByType($type); + }; $ucName = ucfirst($name); $method = 'createComponent' . $ucName; @@ -131,7 +133,7 @@ protected function createComponent(string $name): ?IComponent $args[] = $name; } - $args = Nette\DI\Resolver::autowireArguments($methodReflection, $args, $sl); + $args = Nette\DI\Resolver::autowireArguments($methodReflection, $args, $getter); $component = $this->{$method}(...$args); if (!$component instanceof Nette\ComponentModel\IComponent && !isset($this->components[$name])) { throw new Nette\UnexpectedValueException("Method $methodReflection did not return or create the desired component.");