的Symfony:導入包路由資源的Symfony:問題導入包路由資源
我試圖使用Symfony的應用程序控制臺來產生捆綁,
$ php app/console generate:bundle
,但我不斷收到問題錯誤
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.
Bundle PulsestormHelloworldBundle is already imported.
有沒有人知道如何解決這個問題?換句話說,這個錯誤的常見原因是什麼,特別是應用控制檯在執行路由的自動更新時所執行的操作。缺乏這一點,是否有理想的地方跳入源代碼開始調試黑客攻擊爲什麼這是失敗?
背景:我是一名經驗豐富的程序員,但對Symfony開發新手。我已經生成了一個新的包,以跟隨一個教程。但是,我意識到我意外地使用註釋格式而不是yaml/yml格式創建了一個包。不確定的不同,我想重新生成捆綁。要做到這一點
我刪除從
AppKernel
捆綁申報我重新生成的
app/bootstrap.php.cache
文件中使用build_bootstrap.php
腳本我打消了我的包的源代碼從
src
它生成的文件夾(此文件夾爲空)
然而,每當我經過generate:bundle
命令步驟運行時,它總是與
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.
Bundle PulsestormHelloworldBundle is already imported.
所以,我的假設是有從是造成此錯誤上一代的嘗試我的代碼庫的一些artificat結束,但我沒有足夠的Symfonyt經驗來追蹤這一點。
我已經在下面列出了整個CLI交互,以防故障排除。
$ php app/console generate:bundle
Welcome to the Symfony2 bundle generator
Your application code must be written in bundles. This command helps
you generate them easily.
Each bundle is hosted under a namespace (like Acme/Bundle/BlogBundle).
The namespace should begin with a "vendor" name like your company name, your
project name, or your client name, followed by one or more optional category
sub-namespaces, and it should end with the bundle name itself
(which must have Bundle as a suffix).
See http://symfony.com/doc/current/cookbook/bundles/best_practices.html#index-1 for more
details on bundle naming conventions.
Use/instead of \ for the namespace delimiter to avoid any problem.
Bundle namespace: Pulsestorm/Bundle/HelloworldBundle
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 PulsestormHelloworldBundle.
Bundle name [PulsestormHelloworldBundle]:
The bundle can be generated anywhere. The suggested default directory uses
the standard conventions.
Target directory [/Users/alanstorm/Documents/github_oro/crm-application/src]:
Determine the format to use for the generated configuration.
Configuration format (yml, xml, php, or annotation) [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 "Pulsestorm\Bundle\HelloworldBundle\PulsestormHelloworldBundle" bundle
in "/Users/alanstorm/Documents/github_oro/crm-application/src/" using the "yml" format.
Do you confirm generation [yes]?
Bundle generation
Generating the bundle code: OK
Checking that the bundle is autoloaded: OK
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.
Bundle PulsestormHelloworldBundle is already imported.
'Bundle PulsestormHelloworldBundle已經導入.''檢查你的'routing.yml'。看起來你已經爲這個包添加了路由 –
@forgottenbas這似乎不太可能,因爲在嘗試重新創建它之前,該包已從src'中刪除。或者是否有另一個routing.yml的地方?還是CLI在前面的步驟中生成的代碼混淆? –
@forgottenbas和從頭開始 - 我剛剛發現了'app/confgig/routing.yml'。感謝您的提示,很有幫助。 –