Symfony2 how do you create your own yml file for sharing globally?

I am looking to create my own yml file to save some global settings and vars that I can reuse in my project. I searched here and found another answer, but it does not work for me

Set your own options in symfony2

I want to add a report_settings.yml file so that it automatically loads into my project.

this is what i still founded

#app/config/config.yml imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: report_settings.yml } .. rest of config file -- 

and the im file trying to include looks like this:

 #report_settings.yml something: something1: "test" 

It returns the following error

 FileLoaderLoadException: Cannot import resource "/var/www/pcPortal/app/config/report_settings.yml" from "/var/www/pcPortal/app/config/config.yml". 

and

 InvalidArgumentException: There is no extension able to load the configuration for "something" (in /var/www/pcPortal/app/config/report_settings.yml). Looked for namespace "something", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra", "jms_aop", "jms_di_extra", "jms_security_extra", "sj_query", "web_profiler", "sensio_distribution" 

From reading the error messages, it looks like I missed something? Do I need to add some kind of extension?

+4
source share
1 answer

The simplest would be to put your config in the options section, for example:

 #report_settings.yml parameters: something.something1: "test" 

You can also handle the configuration using your own extension, see http://symfony.com/doc/master/book/service_container.html#importing-configuration-via-container-extensions

+7
source

All Articles