Undefined option "mapping_types" by multiple connections
I am trying to add type "enum" to my symfony2 dbal connection but I cannot 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 configuration right now and I am getting the error:
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]
Unrecognized option "mapping_types" under "doctrine.dbal"
I also tried to put it under connection2 and removed the default_connection since I found answers that solved the problem like this. But these questions didn't have multiple connections.
+3
source to share
2 answers
mapping_types
must be located under the specific connection. So, you need the following configuration:
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
+9
source to share