从现有数据库生成实体时,无效的参数异常 [英] Invalid Argument Exception when generating Entities from existing database
问题描述
为了做到这一点,我遵循<在Symfony网站上的href =http://symfony.com/doc/2.0/cookbook/doctrine/reverse_engineering.html =noreferrer>教程,但是当我运行以下命令时: p>
php app / console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-数据库--force
我立即收到以下错误:
[InvalidArumentException]
名为的Doctrine ORM Manager不存在。
任何人都可以解释我出错的地方,以及我如何解决这个问题?
最后找出导致错误的原因。看来config.yml中的教条配置设置需要一个名为 auto_mapping:true
的参数。
例如:
doctrine:
dbal:
驱动程序:%database_driver%
host: %database_host%
dbname:%database_name%
user:%database_user%
password:%database_password%
orm:
auto_mapping:true
更多信息可以在这里找到: http://symfony.com/doc/2.0/reference/configuration/doctrine.html
I'm converting a Symfony 2 project from Propel to Doctrine and wish to convert the existing database into Doctrine Entities.
To do this I'm following the tutorial on the Symfony website, however when I run the following command:
php app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force
I immediately receive the following error:
[InvalidArumentException]
Doctrine ORM Manager named "" does not exist.
Can anyone explain where I'm going wrong and how I go about fixing this?
Finally found out what was causing the error. It appears that the doctrine configuration settings within config.yml require a parameter called auto_mapping: true
.
For example:
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
orm:
auto_mapping: true
More information can be found here: http://symfony.com/doc/2.0/reference/configuration/doctrine.html
这篇关于从现有数据库生成实体时,无效的参数异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!