-
-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DI Extensions can not use parameters from app main configuration #309
Comments
Prior version 3.2.0 this actually worked. |
In this case, the class DIExtension extends CompilerExtension
{
public function loadConfiguration()
{
$config = $this->loadFromFile(__DIR__ . '/di.neon');
$this->loadDefinitionsFromConfig($config['services']);
}
} Before version 3.2.0 it expanded parameters only inside |
Thank you, this way it is working again. |
What is not working this way is: config file in the main app
DI Extension config file loaded via ...
result is:
This was also working prior 3.2.0 using
In 3.2.0 it is not expanding parameters if What is the proper way, how to load DI Extension's config.neon file, incl. expanding parameters of services and preventing this DI\Exception to be thrown in v3.2.0? |
@dg shall we wait for any update on this issue, or shall we achieve functionality of adding setup: to services from the main App in the DI Extension .neon files another way (our own) -- not using any of Nette methods |
Look, I think your use case is very unusual, so it's definitely better if you solve it yourself. |
OK, I tried it, but it looks the problem is broader.
I mean this:
.neon file is loaded via
The result is Nette\DI\ServiceCreationException: So basically all services must be registered in the main App .neon files, not in .neon files of DIExtension package, only then:
It doesn't look flexible to me -- to use DIExtension is quite complicated this way, if only one of services in the .neon file needs its parameter to be expanded and @serviceName is used in other neon file. It is forcing us to move all services to main app .neon files, or to avoid using %parameters% in DIE, or to use other workaround. |
If |
Version: 3.2.0
Bug Description
config/common.neon
DIExtension class
di.neon
Parameter
secretDir
is not exchanged (translated) with its valuemySecretDir
Expected Behavior
Parameter
secretDir
will be "translated" to its valuemySecretDir
Possible Solution
Load configs in
\Nette\DI\Compiler::processExtensions()
before running this$first
extensions:The text was updated successfully, but these errors were encountered: