【问题标题】:Invalid Argument Exception when generating Entities from existing database从现有数据库生成实体时出现无效参数异常
【发布时间】:2013-01-02 18:40:52
【问题描述】:

我正在将一个 Symfony 2 项目从 Propel 转换为 Doctrine,并希望将现有数据库转换为 Doctrine 实体。

为此,我正在关注tutorial on the Symfony website,但是当我运行以下命令时:

php app/console doctrine:mapping:convert xml ./src/Acme/BlogBundle/Resources/config/doctrine/metadata/orm --from-database --force

我立即收到以下错误:

[InvalidArumentException]
Doctrine ORM Manager named "" does not exist.

谁能解释我哪里出了问题以及我该如何解决这个问题?

【问题讨论】:

    标签: php symfony doctrine-orm symfony-2.1


    【解决方案1】:

    终于找到了导致错误的原因。似乎 config.yml 中的教义配置设置需要一个名为 auto_mapping: true 的参数。

    例如:

    doctrine:
        dbal:
            driver:   "%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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-02
      • 2011-08-15
      • 2021-09-05
      • 2015-08-04
      • 2023-03-07
      • 2013-02-04
      • 1970-01-01
      相关资源
      最近更新 更多