Symfony2: layered options in YML

Here is what I want to do. I have a yml file like ...

My custom yml file:

# app/config/sv_parameters.yml parameters: sv_email: debug: " debug@debug.com " admin: " admin@admin.com " ... 

A config.yml file importing my own options:

 # app/config/config.yml imports: - { resource: sv_parameters.yml } ... 

Config_dev.yml by importing config.yml and using a subparameter of my custom yml file:

 # app/config/config_dev.yml imports: - { resource: config.yml } swiftmailer: delivery_address: "%sv_email.debug%" 

But, when I clear:cache :

 You have requested a non-existent parameter "sv_email.debug". 

I know that in PHP, layered parameters are arrays. But does this mean that we can access them in pure YML?

I could write my sv_email parameters in a string, but this is not as clean as several levels.

+4
source share
1 answer

This is not achievable in YML.
You need to move this nested variable to the top level, and then turn it on in both necessary places.

+2
source

Source: https://habr.com/ru/post/1499341/


All Articles