Skip to content

make imported parameters available immediatly #9361

@mahono

Description

@mahono

Suppose there is a parameters.yml:
parameters:
my_type: foo

Then it is not possible to do this in config.yml:

imports:
- { resource: parameters.yml }
- { resource: %kernel.root_dir%/config/%my_type%/security.yml }

I'm not sure but I guess the problem is that in the load() method of the Yaml(or whatever)FileLoader the parameters are added to the container after all files are imported.

I was hoping that I can immediatly use the parameters from parameters.yml right after it is imported.

I thought I can put something after $this->import() in parseImports() but it seems a bit more complicated.. so I hope someone can have a look at it.

What I need is a way to load different config files depending on parameter(s) in parameters.yml. So different installations of the product can use different predefined configurations without further configuration.

My current idea for a workaround is to parse parameters.yml in the AppKernel->registerContainerConfiguration() before loading the configuration and load the matching files from config/%my_type/config.yml. But this not really nice.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions