symfony2捆绑自动加载失败

Mat*_*eil 2 bundle symfony

我碰巧得到了创作的所有symfony问题......

我想创建一个新项目.

我复制' symfony2 '文件夹,然后重命名:

 php app/console generate:bundle
Run Code Online (Sandbox Code Playgroud)

它说:

  Generating the bundle code: OK
  Checking that the bundle is autoloaded: FAILED
  Confirm automatic update of your Kernel [yes]? 
  Enabling the bundle inside the Kernel: OK
  Confirm automatic update of the Routing [yes]? 
  Importing the bundle routing resource: FAILED

  The command was not able to configure everything automatically.  
  You must do the following changes manually.                      

  - Edit the composer.json file and register the bundle
  namespace in the "autoload" section:

  Bundle MddevPsavBundle is already imported.
Run Code Online (Sandbox Code Playgroud)

为什么是这样?当我上次没有遇到那个问题时,我做了同样的命令?

我该如何解决这个问题呢?我应该将什么添加到该composer.json文件中?

我尝试了一些东西但是得到了:

  Fatal error: Class 'Mddev\PsavBundle\MddevPsavBundle' not found in
  /var/www/projetQ/app/AppKernel.php on line 22
Run Code Online (Sandbox Code Playgroud)

And*_*son 10

如果您遇到问题:

The command was not able to configure everything automatically.  
You must do the following changes manually.
Run Code Online (Sandbox Code Playgroud)

然后告诉你:

- Edit the composer.json file and register the bundle
namespace in the "autoload" section:
Run Code Online (Sandbox Code Playgroud)

假设您已正确遵循捆绑名称约定,那么您将需要:


将新包添加到composer.json文件中

"autoload": {
    "psr-0": {
        "currentbundle\\": "src/",
        "YOURNEWBUNDLE\\": "src/",            
    }
}
Run Code Online (Sandbox Code Playgroud)

然后,您需要再次在composer上运行install

composer -n install --dev
Run Code Online (Sandbox Code Playgroud)

然后,您应该将两个捆绑包自动加载