我正在寻找创建我自己的yml文件来存储一些全局设置和变量,我可以在我的项目中重新使用它们。我已经在这里搜查,发现另一个答案然而symfony2如何创建自己的自定义yml文件以全局共享?
Set own parameters in symfony2
我期待加入report_settings.yml文件,以便它在我的项目中自动加载它并没有为我工作。
这是我迄今基于
#app/config/config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: report_settings.yml }
.. rest of config file --
和文件即时试图包括看起来像这样
#report_settings.yml
something:
something1: "test"
它返回以下错误
FileLoaderLoadException: Cannot import resource "/var/www/pcPortal/app/config/report_settings.yml" from "/var/www/pcPortal/app/config/config.yml".
和
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"
从阅读错误信息看起来我错过了什么?我是否需要添加某种扩展?
我的问题可能是有用的 - HTTP:// stackoverflow.com/questions/32482622/creating-a-configuration-file-in-symfony2/32502618#32502618 – Peter 2015-09-10 14:26:21