Import yml config in symfony2 config.yml file
Solution 1
Configuration from config.yml is loaded by extensions. Do you have one for your sso_accounts? It seems that you haven't.
You can read how it works here: http://symfony.com/doc/current/cookbook/bundles/extension.html
Solution 2
If above answer dont work, try this (Symfony 2.3.4):
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: @FolderYourBundleName/Resources/config/config.yml }
The Config File must then be located at src/Folder/YourBundleName/Resources/config/config.yml
I'am fairly new to Smyfony2 so I dont know if this is a good approach tho.
Solution 3
If you dont work with a bundle (and therefore its not registered, and cannot be accessed by @MyBundleName/Resources....) you could also do
//config.yml
- { resource: '../../src/Some/Where/Configuration/settings.yml' }
Comments
-
guillaumepotier almost 2 years
In my Symfony2 config.yml file, I'd like to import some configs that I'd prefer gather in a separate yml file.
I used:
imports: - { resource: parameters.yml } - { resource: sso_accounts.yml }
And in my sso_accounts.yml file I basically have:
sso_accounts: company: publickey: publickey secret: privatekey users: [ [email protected], [email protected] ]
But (there's always a but...) I got this error:
Whoops, looks like something went wrong. 2/2 FileLoaderLoadException: Cannot import resource "/Users/mycomp/Sites/myapp/app/config/sso_accounts.yml" from "/Users/mycomp/Sites/myapp/app/config/config.yml". 1/2 InvalidArgumentException: There is no extension able to load the configuration for "sso_accounts" (in /Users/mycomp/Sites/myapp/app/config/sso_accounts.yml). Looked for namespace "sso_accounts", found "framework", "security", "twig", "monolog", "swiftmailer", "doctrine", "assetic", "sensio_framework_extra", "jms_security_extra", "problematic_acl_manager", "twig_js", "fos_js_routing"
What's wrong with my import?