Search code examples
phpsymfonyconfigurationsymfony-3.3

Merging config parameters in Symfony


I currently fight with Symfony's configuration processing. I want to override certain nested parameters for the dev environment.

My config.yml contains:

parameters:
    curl:
        return_transfer: true
        timeout: 25
        connect_timeout: 2

My config_dev.yml contains:

parameters:
    curl:
        timeout: 60

So, I only want to override one (nested) config parameter "timeout". But I only get this (overridden) parameter in the dev environment container. The other ones (return_transfer and connect_timeout) are gone. It seems that the whole parameter config is replaced and not merged with config.yml. How may a merge these parameters?


Solution

  • Parameters is a single-dimensional array. This means that your curl parameter is actually an array of values, not parameters. I believe you can only duplicate these in your dev parameters.

        return_transfer: true
        connect_timeout: 2