我有一个包含2个数据库连接的项目(default
和routeone
)。我的配置是这样的:
dbal:
default_connection: routeone
types:
point: ACME\Infrastructure\Resources\Types\PointType
connections:
default:
driver: pdo_mysql
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8
routeone:
driver: pdo_mysql
host: "%database_routeone_host%"
port: "%database_routeone_port%"
dbname: "%database_routeone_name%"
user: "%database_routeone_user%"
password: "%database_routeone_password%"
charset: UTF8
mapping_types:
enum: string
point: point
orm:
default_entity_manager: routeone
auto_generate_proxy_classes: "%kernel.debug%"
entity_managers:
default:
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
ACME:
type: yml
dir: '%kernel.root_dir%/../src/ACME/Infrastructure/Resources/doctrine'
is_bundle: false
prefix: ACME\Domain\Entity
alias: ACME
routeone:
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: false
mappings:
RouteOne:
type: yml
dir: '%kernel.root_dir%/../src/ACME/Infrastructure/Resources/doctrine/RouteOne'
is_bundle: false
prefix: RouteOne
alias: RouteOne
我可以控制default
连接,但不能控制routeone
。我无法在routeone
中更改现有数据库的结构。
当我使用此命令生成YML配置文件时(注意我暂时将routeone连接作为默认设置):
php bin/console doctrine:mapping:convert yml ./src/ACME/Infrastructure/Resources/doctrine/Routeone/ --from-database
这会在此路径中生成一个文件:AclClass.orm.yml
AclClass:
type: entity
table: acl_class
....
但是当我想用这个命令生成实体类时:
php bin/console doctrine:generate:entities src/ACME/Infrastructure/Resources/doctrine/RouteOne/ --path=src/ACME/Domain/Entity/RouteOne/
提示此错误:
[Doctrine\Common\Persistence\Mapping\MappingException]
No mapping file found named 'AclClass.orm.yml' for class 'ACME\Domain\Entity\RouteOne\AclClass'.
我做错了什么?