Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MasterSlaveConnection and configuration of default_table_options #900

Closed
Spawnrad opened this issue Dec 20, 2018 · 3 comments
Closed

MasterSlaveConnection and configuration of default_table_options #900

Spawnrad opened this issue Dec 20, 2018 · 3 comments
Assignees
Labels
Milestone

Comments

@Spawnrad
Copy link
Contributor

Spawnrad commented Dec 20, 2018

Hi,

When i use MasterSlave configuration on doctrine the parameter default_table_options is not taken.
But once i remove the slave configuration it work and my tables is create with my charset configuration.

Here my doctrine configuration :

doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%env(DATABASE_MASTER_HOST)%"
        dbname:   "%env(DATABASE_DBNAME)%"
        user:     "%env(DATABASE_USER)%"
        password: "%env(DATABASE_PASSWORD)%"
        slaves:
            slave1:
                host:     "%env(DATABASE_SLAVE_HOST)%"
                dbname:   "%env(DATABASE_DBNAME)%"
                user:     "%env(DATABASE_USER)%"
                password: "%env(DATABASE_PASSWORD)%"
        charset: utf8mb4
        default_table_options:
            charset: utf8mb4
            collate: utf8mb4_unicode_ci  

Its looks like that the defaultTableOptions have no data when i use MasterSlave configuration :

array:6 [
  "driver" => "pdo_mysql"
  "slaves" => array:1 [
    "slave1" => array:6 [
      "host" => "db:3306"
      "dbname" => "databasename"
      "user" => "root"
      "password" => "root"
      "port" => null
      "driver" => "pdo_mysql"
    ]
  ]
  "driverOptions" => []
  "master" => array:8 [
    "host" => "db:3306"
    "dbname" => "databasename"
    "user" => "root"
    "password" => "root"
    "charset" => "utf8mb4"
    "port" => null
    "defaultTableOptions" => array:2 [
      "charset" => "utf8mb4"
      "collate" => "utf8mb4_unicode_ci"
    ]
    "driver" => "pdo_mysql"
  ]
  "wrapperClass" => "Doctrine\DBAL\Connections\MasterSlaveConnection"
  "defaultTableOptions" => []
]

Once i remove the slave for example i have that result and it work very well :

array:9 [
  "driver" => "pdo_mysql"
  "host" => "db:3306"
  "dbname" => "databasename"
  "user" => "root"
  "password" => "root"
  "charset" => "utf8mb4"
  "port" => null
  "driverOptions" => []
  "defaultTableOptions" => array:2 [
    "charset" => "utf8mb4"
    "collate" => "utf8mb4_unicode_ci"
  ]
]

Thank you

@Spawnrad
Copy link
Contributor Author

any news please?

@alcaeus
Copy link
Member

alcaeus commented Feb 5, 2019

Fixed in #915.

@alcaeus alcaeus closed this as completed Feb 5, 2019
@Spawnrad
Copy link
Contributor Author

Spawnrad commented Feb 5, 2019

Thank you @alcaeus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants