我无法创建捆绑包。我正在收到“检查捆绑包是否已自动加载:失败”,这在以前从未发生过。以下步骤一直有效,直到今天。
任何解决方案?
设置Symfony2:
我已下载:Symfony_Standard_Vendors_2.4.5.zip
我在/var/www/html/local/three
下解压缩。 三个是主文件夹。
我设置了权限:
desktop@ubuntu:/var/www/html/local/three$ sudo chown desktop -R app/logs
desktop@ubuntu:/var/www/html/local/three$ sudo chown desktop -R app/cache
desktop@ubuntu:/var/www/html/local/three$ sudo chmod 777 -R app/cache
desktop@ubuntu:/var/www/html/local/three$ sudo chmod 777 -R app/logs
此网址可以正常使用:http://localhost/local/three/web/app_dev.php
创建我的捆绑包:
desktop@ubuntu:/var/www/html/local/three$ php app/console generate:bundle --namespace=Myblog/PublicBundle
Welcome to the Symfony2 bundle generator
In your code, a bundle is often referenced by its name. It can be the
concatenation of all namespace parts but it's really up to you to come
up with a unique name (a good practice is to start with the vendor name).
Based on the namespace, we suggest MyblogPublicBundle.
Bundle name [MyblogPublicBundle]:
The bundle can be generated anywhere. The suggested default directory uses
the standard conventions.
Target directory [/var/www/html/local/three/app/cache/dev/../src]:
Determine the format to use for the generated configuration.
Configuration format (yml, xml, php, or annotation): yml
To help you get started faster, the command can generate some
code snippets for you.
Do you want to generate the whole directory structure [no]? yes
Summary before generation
You are going to generate a "Myblog\PublicBundle\MyblogPublicBundle" bundle
in "/var/www/html/local/three/app/cache/dev/../src/" using the "yml" format.
Do you confirm generation [yes]? yes
Bundle generation
Generating the bundle code: OK
Checking that the bundle is autoloaded: FAILED
Confirm automatic update of your Kernel [yes]? yes
Enabling the bundle inside the Kernel: OK
Confirm automatic update of the Routing [yes]? yes
Importing the bundle routing resource: OK
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:
答案 0 :(得分:2)
解决:
问题与线路有关:
Target directory [/var/www/html/local/three/app/cache/dev/../src]:
我不明白为什么它建议cache
路径。过去总是自动建议 src 目录。我已经检查了我的日志,这就是我知道的原因。无论如何将其改为:
/var/www/html/local/three/src
完成!
答案 1 :(得分:0)
这是一个已知的问题,我想它将在下一个版本
上修复https://github.com/symfony/symfony/issues/10972
https://github.com/symfony/symfony/pull/10999
https://github.com/symfony/symfony-standard/issues/659
现在,当generate:bundle显示:
可以在任何地方生成捆绑包。建议的默认目录 使用标准惯例。
目标目录: - / type / your / directory / src here