数据库没有任何映射信息Symfony2原则


Database does not have any mapping information Symfony2 Doctrine

注意:这不是一个重复的问题,因为我已经尝试了我在谷歌上得到的一切,但没有任何帮助我们。

我正在尝试使用Doctrine逆向工程工具导入表,但我得到这个消息:

数据库中没有映射信息

My Connection Details in Config.yml

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                driver:   pdo_mysql
                host:     localhost
                port:     null
                dbname:   pixel_ashish
                user:     root
                password: abc123
                charset:  UTF8
                schema_filter: ~^(?!some_table1|some_table2)~
    orm:
            default_entity_manager:  default
            auto_generate_proxy_classes:  true
            proxy_dir:            "%kernel.cache_dir%/doctrine/orm/Proxies"
            proxy_namespace:      Proxies
            resolve_target_entities: []

What I have try So Far:

  1. 运行php app/console doctrine:mapping:import——force AcmeBlogBundle xml给出相同的错误
  2. 尝试转换映射也没有任何意义,因为映射不存在,但仍然尝试没有工作。
  3. 创建了一个新项目,并尝试了上述给定的配置,但没有成功。

现在我无计可施,请帮我解决这个问题

您需要在配置中创建一些映射信息。

您可以通过在orm部分下传递auto_mapping: true来实现:

doctrine:
    orm:
        auto_mapping: true

或在orm部分下手动定义:

doctrine:
    orm:
        default_entity_manager: default
        entity_managers:
            default:
                connection: default
                mappings:
                    YourBundleName:
                        type: "xml"
                        dir:  "Entity"
                        prefix: "Your'BundleName'Entity"