Reference to missing service ‘extension.x’ in nette/di 3.0
- Pavel Janda
- Member | 977
In nette 2.4, in DIC extension, when referencing a service from neon registered in PHP, there was no error. Example code:
DIC – PHP:
$builder->addDefinition($this->prefix('foo'))
->setType(Foo::class);
$this->compiler::loadDefinitions(
$builder,
$this->loadFromFile(__DIR__ . '/some-other-stuff.neon'),
$this->name
);
some-other-stuff.neon:
- Bar(@extension.foo)
Nette 3.0 code:
DIC – PHP:
$builder->addDefinition($this->prefix('foo'))
->setType(Foo::class);
$this->compiler->loadDefinitionsFromConfig(
$this->loadFromFile(__DIR__ . '/some-other-stuff.neon')
);
some-other-stuff.neon:
- Bar(@extension.foo)
Result:
Nette\DI\ServiceCreationException
Service of type Bar: Reference to missing service 'extension.foo'. (used in __construct())
Any change how to fix that?
Last edited by Pavel Janda (2019-09-09 16:29)
- Pavel Janda
- Member | 977
And where did go the “namespace” parameter from loadDefinitions (loadDefinitionsFromConfig)?