There is no extension able to load the configuration

后端 未结 2 533
温柔的废话
温柔的废话 2021-01-14 00:48

I\'m trying to load custom config but getting exception:

1/2 InvalidArgumentException in YamlFileLoader.php

There is no extension able to load the

相关标签:
2条回答
  • 2021-01-14 01:06

    You have to manually register extension class, how to do it is described here http://symfony.com/doc/current/cookbook/bundles/extension.html#manually-registering-an-extension-class

    Something like this:

    //.....
    class CwiczeniaDependencyInjectionBundle extends Bundle
    {
    
      public function getContainerExtension()
      {
        if (null === $this->extension) {
            $this->extension = new CwiczeniaExtension();
        }
        return $this->extension;
      }
    }
    
    0 讨论(0)
  • 2021-01-14 01:20

    I had the same problem, and fix it.

    To register an extension you need to have same name for bundle and you extension. So, if you wanna enable your extension as cwiczenia, your extension file must be named as CwiczeniaExtention and bundle must be named as CwiczeniaBundle.

    Or if you don't wanna change your Bundle name (CwiczeniaDependencyInjectionBundle), you must rename your extension to CwiczeniaDependencyInjectionExtension and then it will be available to load the configuration as cwiczenia_dependency_injection.

    Or you can manually register extension, as mentioned above by @helios

    0 讨论(0)
提交回复
热议问题