1

To preface my question, I have tried every solution suggested by this StackExchange question.

This is the error given:

[Doctrine\DBAL\DBALException]
Unknown column type "enumAddressSource" requested. Any Doctrine type t
hat you use has to be registered with \Doctrine\DBAL\Types\Type::addTy
pe(). You can get a list of all the known types with \Doctrine\DBAL\Ty
pes\Type::getTypesMap(). If this error occurs during database introspe
ction then you might have forgot to register all database types for a
Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or h
ave your custom types implement Type#getMappedDatabaseTypes(). If the
type name is empty you might have a problem with the cache or forgot s
ome mapping information.

This error is identical with the one that I had received prior to trying any fixes.

This is the current Doctrine code in the config.yml file:

doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        mapping_types:
            enum: string
            enumAddressSource: string
            # if using pdo_sqlite as your database driver:
            #   1. add the path in parameters.yml
            #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
            #   2. Uncomment database_path in parameters.yml.dist
            #   3. Uncomment next line:
            #     path:     "%database_path%"

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true

The relevant code under vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySqlPlatform.php:

protected function initializeDoctrineTypeMappings()
{
    $this->doctrineTypeMapping = array(
        'tinyint'       => 'boolean',
        'smallint'      => 'smallint',
        ...
        'enum'          => 'string',
        'enumAddressSource' => 'string',
    );

I would try to take the advice shown here: Doctrine Cookbook, but the article does not plainly specify which file this code is to be injected into (Referring specifically to option 1). It also appears to me that the code shown would be covered by the code injected at the bottom of the second code example.

This occurs for all enums in the database. Changing the database manually isn't exactly an option. What else can I try?

Community
  • 1
  • 1
LightToTheEnd
  • 1,399
  • 2
  • 9
  • 11
  • ENUM is an evil data type in general! There are more examples but you can start from [this](http://komlenic.com/244/8-reasons-why-mysqls-enum-data-type-is-evil/) – BentCoder Jul 29 '15 at 20:22
  • @BentCoder If I could change it, I would, but it's not my database to change. – LightToTheEnd Jul 29 '15 at 20:36

2 Answers2

0

not sure of the purpose of: enumAddressSource: string

Shouldn't enum: string (as in the line before it) be enough?

There error message you are getting is basically telling you that there is no type thats called "enumAdressSource", thus no such type can be mapped to string. You are mapping types, not fields here.

ppetermann
  • 306
  • 1
  • 4
0

The causes of the error were comments nested in the columns of the MySQL database. I never would have guessed that Doctrine would read these comments and try to interpret them. Deleting the comments fixed the problem. I could not find further documentation on this issue. If anyone has a good source, please comment (or edit) this answer.

LightToTheEnd
  • 1,399
  • 2
  • 9
  • 11