title: How to expose semantic configuration
body: <p>In the process of building a third party bundle for the Symfony2 framework I have run into a problem with allowing configuration to happen in the app/config.yml file. I want to do this so users of the bundle (mostly myself) won't have to go into the bundle to make configuration changes.</p>
  
  <p>My bundle Configuration.php file reads:</p>
  
  <pre><code>&lt;?php
  
  namespace Ms2474\AuthNetBundle\DependencyInjection;
  
  use Symfony\Component\Config\Definition\Builder\NodeBuilder;
  use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  use Symfony\Component\Config\Definition\ConfigurationInterface;
  
  class Configuration implements ConfigurationInterface
  {
      public function getConfigTreeBuilder() {
          $treeBuilder = new TreeBuilder();
          $rootNode = $treeBuilder-&gt;root('authorize_net');
          $rootNode
              -&gt;children()
                  -&gt;scalarNode('login_id')-&gt;defaultNull()-&gt;end()
                  -&gt;scalarNode('transaction_key')-&gt;defaultNull()-&gt;end()
                  -&gt;booleanNode('sandbox')-&gt;defaultValue(true)-&gt;end()
                  -&gt;scalarNode('log_file')-&gt;defaultValue(false)-&gt;end()
              -&gt;end();
  
          return $treeBuilder;
      }
  }
  </code></pre>
  
  <p><br />
  The bundle extension file (Ms2474AuthNetBundleExtension.php) reads:</p>
  
  <pre><code>&lt;?php
  
  namespace Ms2474\AuthNetBundle\DependencyInjection;
  
  use Symfony\Component\HttpKernel\DependencyInjection\Extension;
  use Symfony\Component\DependencyInjection\ContainerBuilder;
  use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  use Symfony\Component\Config\FileLocator;
  use Symfony\Component\Config\Definition\Processor;
  
  class Ms2474AuthNetBundleExtension extends Extension
  {
      public function load(array $configs, ContainerBuilder $container)
      {
          $processor = new Processor();
          $configuration = new Configuration();
          $config = $processor-&gt;process($configuration-&gt;getConfigTree(), $configs);
  
          if (null === $config['sandbox']) {
              $config['sandbox'] = $container-&gt;getParameter('kernel.debug');
          }
  
          $container-&gt;setParameter('authorize_net.login_id', $config['login_id']);
          $container-&gt;setParameter('authorize_net.transaction_key', $config['transaction_key']);
          $container-&gt;setParameter('authorize_net.sandbox', $config['sandbox']);
  
          if (isset($config['log_file'])) {
              $container-&gt;setParameter('authorize_net.log_file', $config['log_file']);
          }
  
          $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
          $loader-&gt;load('services.yml');
      }
  }
  </code></pre>
  
  <p><br />
  <b>Now for the problem:</b>
  <br />
  When I try to add the following to the app/config.yml file:</p>
  
  <pre><code>authorize_net:
      login_id: 1234
      transaction_key: 1234
      sandbox: true
      log_file: false
  </code></pre>
  
  <p>I get the following two errors:</p>
  
  <pre><code>InvalidArgumentException: There is no extension able to load the configuration for "authorize_net" (in /path/to/app/config/config.yml). Looked for namespace "authorize_net", found "framework", "security", "twig", "monolog", "swiftmailer", "assetic", "doctrine", "sensio_framework_extra", "jms_security_extra", "jms_aop", "fos_user", "jms_serializer", "fos_rest", "stof_doctrine_extensions", "vich_uploader", "gri_user", "gri_campaign", "gri_authorized_contact", "web_profiler", "sensio_distribution"
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>FileLoaderLoadException: Cannot import resource "/path/to/app/config/config.yml" from "/path/to/app/config/config_dev.yml".
  </code></pre>
  
  <p><br />
  <b>And the question:</b><br />
  What am I doing wrong here? I have looked through the <a href="http://symfony.com/doc/current/cookbook/bundles/extension.html" rel="nofollow">documentation</a> and also compared my code to other bundles such as the <a href="https://github.com/FriendsOfSymfony/FOSUserBundle" rel="nofollow">FOSUserBundle</a>.</p>