php Symfony 2 - 如何删除一个包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12142425/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 02:55:18  来源:igfitidea点击:

Symfony 2 - How to delete a bundle?

phpsymfonysymfony-2.1

提问by Limeni

So my question is how to delete bundle I created?

所以我的问题是如何删除我创建的包?

You create bundles with this console command:

您可以使用以下控制台命令创建捆绑包:

php app/console generate:bundle --namespace=Test/BlogBundle --format=yml

And thats awsome but what if I need to delete this bundle? Is there a console command to delete a bundle I dont need any more?

这太棒了,但如果我需要删除这个包怎么办?是否有控制台命令可以删除我不再需要的包?

I know that when you create new bundle from console, you:

我知道当您从控制台创建新包时,您:

1. create /src/Test/BlogBundle directory
2. change /app/config/routing.yml file to include routes
3. include your new bundle in /app/Resources/App.Kernel.php
4. I think there is something changed in /app/cache/...

Now what would be correct way of deleting a bundle completely?

现在完全删除捆绑包的正确方法是什么?

Its joust that using console these bundles are generated "magically" so I dont know what did this command changed in folder structure and files?

使用控制台这些包是“神奇地”生成的,所以我不知道这个命令在文件夹结构和文件中发生了什么变化?

回答by GregPK

It is basically the process you have outlined, only in somewhat different order.

这基本上是您概述的过程,只是顺序略有不同。

  1. delete/src/Test/BlogBundle directory
  2. change /app/config/routing.yml file to remove the bundleroutes
  3. removeyour new bundle from/app/AppKernel.php
  4. clear cache(either by deleting cache/{$env} or console cache:clear)
  1. 删除/src/Test/BlogBu​​ndle 目录
  2. 更改 /app/config/routing.yml 文件以删除捆绑路由
  3. /app/AppKernel.php 中删除您的新包
  4. 清除缓存(通过删除缓存/{$env} 或控制台缓存:清除)

If this wasn't installed using a dependency manager - that should be all.

如果这不是使用依赖项管理器安装的 - 这应该是全部。

回答by Baig

I know I am late to answer this but Symfony has instructionson how to delete the bundle. This is how I delete. You can use the same instructions for other bundles you created and want to remove now.

我知道我迟到回答这个,但是Symfony的具有说明如何删除软件包。我就是这样删除的。您可以对您创建的其他捆绑包使用相同的说明并立即删除。