我想把表格从order
改为shop_order
。首先,我在phpmyadmin中更改表名。
此外,我猜,更改注释就足够了:
/**
* Order
*
* @ORM\Table(name="shop_order")
* @ORM\Entity
*/
class Order { ...
但是在跑步的时候
php bin/console doctrine:schema:update --dump-sql
它试图再次创建表:
CREATE TABLE `order` (id INT AUTO_INCREMENT NOT NULL ...
我还需要更改其他文件吗?
最佳答案
清除缓存并再次尝试使用phpMyAdmin更改表名。一旦再次order
,则使用条令命令:
php bin/console doctrine:schema:update --dump-sql
如果您希望Doctrine执行更改,那么也添加
--force
。还要检查你的条令配置,它可能是缓存元数据在其他地方(例如memcache)。你可能也需要澄清这一点。
条令缓存分为三个层次:查询缓存、元数据缓存和结果缓存。您可能想看看元数据。
doctrine:
orm:
auto_mapping: true
# each caching driver type defines its own config options
metadata_cache_driver: apc
result_cache_driver:
type: memcache
host: localhost
port: 11211
instance_class: Memcache
# the 'service' type requires to define the 'id' option too
query_cache_driver:
type: service
id: my_doctrine_common_cache_service
因此,例如,如果您的设置为memcache,则还必须重置memcache。
看看这些文件。