我的config.yml
文件中默认有(dev,prod环境)和test(对于我的测试套件)基本上有两个不同的Doctrine连接。这里是我的默认Connexion的配置:Symfony2 ACL和Doctrine2:数据库永远不会与当前实体元数据同步
# 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做到这些要求,它总是会结果相同。表在这里,外键ok,但教条总是会认为它不与元数据同步..
我不知道是否有问题,因为在我的应用程序中,所有功能都很完美,ACL功能很强大,但我感觉有点儿当我更新我的模式或验证它看到这种情况时会感到沮丧。
对此的帮助将不胜感激。
谢谢!
编辑:我在Symfony2.1 RC4