Entity Generation for Single Table

拥有回忆 提交于 2019-12-13 19:01:28

问题


So I want to generate entities for specific tables in a database that has a huge amount of tables.

Here is the command I'm trying:

php app/console doctrine:mapping:convert yml ./src/MyNamespace/Bundle/MyNamespaceBundle/Resources/config/doctrine/metadata/orm --from-database --em=my_manager --filter=TblReports --verbose

Here is the error:

[Doctrine\DBAL\DBALException]                                                                            
  Unknown database type unknown requested, Doctrine\DBAL\Platforms\PostgreSqlPlatform may not support it. 

Now I can run this command on a smaller database with only a few tables and it works fine, so it has to be the database.

Yes I want to filter this one table:

--filter=TblReports

If I remove the filter it generates entities for the entire database, which is what I don't want.

I'm running PostgreSQL 8.4 and 9.1 if that matters.

Anyone else have or know how to fix this issue?

Unknown database type unknown requested

Doctrine Docs

  • http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/tools.html#reverse-engineering

Releated:

  • Generating a single Entity from existing database using symfony2 and doctrine

UPDATE: Adding my_manager ( config.yml )

# Doctrine Configuration
doctrine:
    dbal:
      default_connection: my_database
      connections:
        my_database:
          driver:   pdo_pgsql
          port:     5432
          dbname:   tbl_reports
          user:     foo_user
          password: foo_pass
          charset:  UTF8
          mapping_types:
            bit: string

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        default_entity_manager: my_manager
        entity_managers:
            my_manager:
                connection: my_database
                mappings:
                    MyNamespaceBundle:
                      mapping: true
                      dir: Entity/Reports

in config_dev.yml ( I use the dev and prod yml files to control the host(s) I can connect to )

# Doctrine Configuration
doctrine:
    dbal:
      connections:
        my_database:
          host: 172.0.0.1

回答1:


I agree with Ziumin that it's likely an issue with the data type in your Postgres database. Possibly an Enum or similar.

What I would do is try to convert the tables one by one until you narrow it down to the problem table, and then look at the data types and it should be fairly obvious.



来源:https://stackoverflow.com/questions/13732017/entity-generation-for-single-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!