Skip to content
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

Parameters in includes #313

Open
netolicak opened this issue Mar 31, 2024 · 0 comments
Open

Parameters in includes #313

netolicak opened this issue Mar 31, 2024 · 0 comments

Comments

@netolicak
Copy link

netolicak commented Mar 31, 2024

Version: 3.1.10

Bug Description

Includes section can expand only parameters which are set to Nette\DI\Config\Loader::setParameters. Parameters which are set in parameters section in config files are ignored.

Steps To Reproduce

Neon file:

parameters:
  # filesystem type local|s3|ftp
  filesystemType: local

includes:
  - filesystems/filesystem-%filesystemType%.neon

Ends with exception Nette\InvalidArgumentException Missing parameter 'filesystemType'.

Expected Behavior

Before processing includes section in neon files merge parameters from parameters section.

Possible Solution

Maybe this change can be enough:

In /src/DI/Config/Loader.php:56 add these lines:

if (isset($data[Nette\DI\Compiler::Parameters])) {
	$this->parameters = Nette\Schema\Helpers::merge($this->parameters, $data[Nette\DI\Compiler::Parameters]);
	$this->parameters = Nette\DI\Helpers::expand($this->parameters, $this->parameters, true);
}

And of course, make public constant Nette\DI\Compiler::Parameters ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant