Entity Generation for Single Table

2019-07-30 18:48发布

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

Releated:

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条回答
欢心
2楼-- · 2019-07-30 19:26

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.

查看更多
登录 后发表回答