Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unrecognized option "mapping_types" by multiple connections

I'm trying to add the "enum" type to my symfony2 dbal connection, but I can't find a way to do it.

doctrine:
    dbal:
        mapping_types:
            enum: string
        default_connection: default
        connections:
            default:
                  driver:   "%database_driver%"
                  host:     "%database_host%"
                  port:     "%database_port%"
                  dbname:   "%database_name%"
                  user:     "%database_user%"
                  password: "%database_password%"
                  charset:  UTF8
            connection2:
                  driver:   "%database2_driver%"
                  host:     "%database2_host%"
                  port:     "%database2_port%"
                  dbname:   "%database2_name%"
                  user:     "%database2_user%"
                  password: "%database2_password%"
                  charset:  LATIN1

This is my config right now and I'm getting the error:

  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  Unrecognized option "mapping_types" under "doctrine.dbal"    

I also tried to place it beneath the connection2 and removed the default_connection since I found answers that solved the problem like this. But these questions haven't had multiple connections.

like image 829
KhorneHoly Avatar asked Dec 15 '22 14:12

KhorneHoly


1 Answers

mapping_types must be located under concrete connection. So you need next config:

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                  mapping_types:
                      enum: string
                  driver:   "%database_driver%"
                  host:     "%database_host%"
                  port:     "%database_port%"
                  dbname:   "%database_name%"
                  user:     "%database_user%"
                  password: "%database_password%"
                  charset:  UTF8
            connection2:
                  mapping_types:
                      enum: string
                  driver:   "%database2_driver%"
                  host:     "%database2_host%"
                  port:     "%database2_port%"
                  dbname:   "%database2_name%"
                  user:     "%database2_user%"
                  password: "%database2_password%"
                  charset:  LATIN1
like image 144
Michael Sivolobov Avatar answered Dec 17 '22 02:12

Michael Sivolobov