ptm*_*.io 6 php mysql symfony doctrine-orm
我想将表从 更改order为shop_order。首先,我在 phpmyadmin 中更改表名。
此外,我会猜到,更改注释就足够了:
/**
* Order
*
* @ORM\Table(name="shop_order")
* @ORM\Entity
*/
class Order { ...
Run Code Online (Sandbox Code Playgroud)
但是跑步的时候
php bin/console doctrine:schema:update --dump-sql
Run Code Online (Sandbox Code Playgroud)
它尝试再次创建表:
CREATE TABLE `order` (id INT AUTO_INCREMENT NOT NULL ...
Run Code Online (Sandbox Code Playgroud)
是否还有其他文件需要更改?
清除缓存并再次尝试使用 phpMyAdmin 更改表名。一旦它order再次然后使用学说的命令:
php bin/console doctrine:schema:update --dump-sql
Run Code Online (Sandbox Code Playgroud)
如果您希望 Doctrine 执行更改,那么也添加--force。
还要检查您的 Doctrine 配置,可能是将元数据缓存在其他地方(例如 Memcache)。您可能还需要清除它。
Doctrine 缓存在三个级别:查询缓存、元数据缓存和结果缓存。您可能需要查看元数据。
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
Run Code Online (Sandbox Code Playgroud)
因此,例如,如果您的设置为 Memcache,那么您也必须重置 Memcache。
看看这里的文档。
| 归档时间: |
|
| 查看次数: |
7503 次 |
| 最近记录: |