我碰巧得到了创作的所有 symfony 问题......
我想创建一个新项目。
我复制“symfony2”文件夹,然后重命名:
php app/console generate:bundle
它说:
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.
这是为什么呢?当我上次没有遇到这个问题时,我执行了相同的命令?
我该如何准确地解决这个问题?我应该在 composer.json
文件中添加什么??
我尝试过一些东西,但我得到:
Fatal error: Class 'Mddev\PsavBundle\MddevPsavBundle' not found in
/var/www/projetQ/app/AppKernel.php on line 22
最佳答案
如果您遇到问题:
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 name conventions正确的话,那么您需要:
<小时/>将新包添加到composer.json文件
"autoload": {
"psr-0": {
"currentbundle\\": "src/",
"YOURNEWBUNDLE\\": "src/",
}
}
然后您需要再次在 Composer 上运行安装
composer -n install --dev
然后您应该自动加载两个包
关于symfony2 包自动加载失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13213010/