如何在Symfony2项目中删除实体类 [英] How to remove an entity class in a Symfony2 project
问题描述
当我们最初设计项目时,到目前为止,我们有几个实体尚未使用(并且我们不打算在不久的将来实现它们)。因此,我想将其从我的项目中删除。我将这样进行操作(手动执行所有步骤):
When we initially designed our project, we had a couple of entities that to date are unused (and we don't plan to implement them in the near future). Ergo I want to remove them from my project. I would proceed like this (all steps manually performed):
- 从我当前使用的实体中删除所有关系。
- 删除文档ORM文件
src / Resources / config / doctrine
- 从<$ c $中删除类PHP文件c> src / Entity
- 从数据库中删除表
- Remove all relations from my currently used entities.
- Delete the doctrime ORM file
src/Resources/config/doctrine
- Delete the class PHP file from
src/Entity
- Remove the table from the database
<我想知道的是:是否有任何例程(例如控制台命令)可以支持此过程?例如,如果我运行
What I would like to know: Are there any routines (e.g. console commands) that may support this procedure? For example, if I run
php app/console doctrine:schema:update --dump-sql
在删除了所有关系并删除了文件之后,我得到了删除相应表的SQL语句吗?
after having removed all relations and deleted the files, that I get the SQL statement that removes the according table(s)?
推荐答案
您删除实体的步骤是可以的。
Your steps to delete an entity are OK.
您可以不要从教义中删除表,因为教义不知道该表。看看这个问题:
You can't remove a table from Doctrine, as Doctrine doesn't know about it. Have a look at this question:
这篇关于如何在Symfony2项目中删除实体类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!