我的文件中基本上有两个不同的 Doctrine 连接config.yml
,默认(开发、生产环境)和测试(用于我的测试套件)。这是我的默认连接配置:
# Doctrine Configuration
doctrine:
dbal:
default_connection: default
connections:
default:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
orm:
default_entity_manager: default
auto_generate_proxy_classes: %kernel.debug%
entity_managers:
default:
connection: default
metadata_cache_driver: array
query_cache_driver: array
result_cache_driver: array
mappings:
[my bundles here..]
在我的security.yml
配置中,我为我的默认连接注册了 ACL:
security:
acl:
connection: default
现在,这是我的问题:
当我运行这些命令时
./app/console doctrine:database:drop --connection=default --force
./app/console doctrine:database:create --connection=default
./app/console doctrine:schema:create --em=prod
我已经创建了 5 个 ACL 相关表。额外的命令
./app/console init:acl
结果是Aborting: The table with name 'myproject_prod.acl_classes' already exists.
然后,稍后,如果我执行./app/console doctrine:schema:update --dump-sql --env=prod
它会导致
ALTER TABLE acl_classes CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL;
ALTER TABLE acl_security_identities CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL;
ALTER TABLE acl_object_identities CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL, CHANGE parent_object_identity_id parent_object_identity_id INT UNSIGNED DEFAULT NULL, CHANGE class_id class_id INT UNSIGNED NOT NULL;
ALTER TABLE acl_object_identity_ancestors CHANGE object_identity_id object_identity_id INT UNSIGNED NOT NULL, CHANGE ancestor_id ancestor_id INT UNSIGNED NOT NULL;
ALTER TABLE acl_entries CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL, CHANGE security_identity_id security_identity_id INT UNSIGNED NOT NULL, CHANGE object_identity_id object_identity_id INT UNSIGNED DEFAULT NULL, CHANGE class_id class_id INT UNSIGNED NOT NULL, CHANGE ace_order ace_order SMALLINT UNSIGNED NOT NULL
我可以使用 --force 来做这些请求,它总是会产生相同的结果。表在这里,外键还可以,但是学说总是会认为它与元数据不同步..
我不知道这是否有问题,因为在我的应用程序中所有功能都完美无缺,ACL 运行良好,但是当我更新我的架构或验证它以看到这种情况时,我感到有点沮丧。
对此的帮助将不胜感激。
谢谢!
编辑:我在 Symfony2.1 RC4