Mayank Awasthi
Mayank Awasthi

Reputation: 337

Doctrine- unknown database type enum requested

I am using doctrine 2 within zend framework 2. To generate entities using database table, the console command used is:

php doctrine-module orm:convert-mapping --force --from-database annotation ./export

When i run above command, it throws an error:

Unknown database type enum requested

How to solve this issue?

Upvotes: 5

Views: 2557

Answers (1)

Ash Singh
Ash Singh

Reputation: 172

You can add:

'doctrine_type_mappings' => array(
    'enum' => 'string'
)

in your global configuration file located in /config/autoload/global.php.

Example code:

        return array(
            'doctrine' => array(
                'connection' => array(
                    'orm_default' => array(
                        'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
                        'params' => array(
                            'host'     => 'localhost',
                            'port'     => '3306',
                            'user'     => 'username',
                            'password' => 'password',
                            'dbname'   => 'DevBrew',

                        ),
                        // To automatically convert enum to string
                        'doctrine_type_mappings' => array(
                            'enum' => 'string'
                        ),
                    )
                )
            )
       );

Upvotes: 12

Related Questions