configurator default parameters not overriden by config.neon
- Matúš Matula
- Member | 257
Hello, I migrated from nette 2.4 to version 3 and stumbled upon this issue
config.neon contains
parameters:
database:
profiler: true
dibi: %database%
I have a class MyConfigurator
extending
Nette\Configurator
in which I set default parameters in
getDefaultParameters()
like this
return [
'database' => [
'profiler' => false,
]
];
The issue is the profiler
within dibi
extension
config is always false
. When I disable the default parameter, it
works. It used to work in nette 2.4, what has changed and how can I make it
work again?
Thanks a lot
- Marek Bartoš
- Nette Blogger | 1261
Imho you just add default parameters too late. Did you try add defaults to $configurator->parameters in __construct()?
- Matúš Matula
- Member | 257
it's actually called from __construct https://github.com/…igurator.php#L71
and I verified the method is called only once
Any other suggestions?
- Marek Bartoš
- Nette Blogger | 1261
I see. Priorities were changed in 3.0 so dynamic things like env variables
have priority over config files which are now considered to be base. Solution
for you would be move default config to file and in __construct() call
$this->addConfig()
https://github.com/…trap/pull/56
Last edited by Mabar (2019-10-25 12:01)
- Matúš Matula
- Member | 257
just to make it clear, if I put the config directly to dibi
section, not via %database%
parameter, it works.. so I guess
it's either bug or unintended feature :)
this works
dibi:
profiler: true
edit: I see, I'm gonna change it now.. Thanks!
Last edited by Matúš Matula (2019-10-25 12:06)
- Matúš Matula
- Member | 257
Thank you @Mabar for your help!
After this change, the name getDefaultParameters() is very confusing & misleading, however