nette/docs

DI: Explain how to use search extension in usage outside of nette framework

Opened this issue · 1 comments

I just played around with nette/di. As I tried to configure the search feature, I've got the following error:
Fatal error: Uncaught Nette\DI\InvalidConfigurationException: Found section 'search' in configuration, but corresponding extension is missing.

In the docs there is no mention of the need to enable this extension first. But as we had the section about extensions above, I tried to add the extension search to the DIC.
The next error was: Fatal error: Uncaught Nette\DI\InvalidConfigurationException: Found section 'extensions' in configuration, but corresponding extension is missing

So I had to look up the source code of the Compiler to find out how to enable the ExtensionsExtension to extend the DIC with the SearchExtension. And nothing of this is explained in the docs.

So I'd suggest, that there should be at least the hint to add the line

$compiler->addExtension('extensions', new Nette\DI\Extensions\ExtensionsExtension());

if you need to configure extensions in the configuration's extensions section.
Also, it should be mentioned in the documentation for the configuration section search that the extension has to be enabled first.

dg commented

Thanks for the suggestion, you're right. I'll make it up.