title: Doctrine. Injecting additional parameter into dbal configuration
body: <p>I have MySQL cluster with master server and 4 slaves.
  The site based on Symfony3, Doctrine is used as ORM and DBAL.
  My config for Doctrine looks like this:</p>
  
  <pre><code>doctrine:
  dbal:
      default_connection: default
      connections:
          default:
              dbname:         "%default_db_master_name%"
              host:           "%default_db_master_host%"
              port:           "%default_db_master_port%"
              user:           "%default_db_master_user%"
              password:       "%default_db_master_password%"
              charset:        UTF8
              driver:         "%default_db_master_driver%"
              logging:        "%kernel.debug%"
              profiling:      "%kernel.debug%"
              wrapper_class:  AppBundle\Connection\AppMasterSlaveConnection
              mapping_types:
                  enum: string
              slaves:
                  slave1:
                      host:     "%default_db_slave1_host%"
                      port:     "%default_db_slave_port%"
                      dbname:   "%default_db_slave_name%"
                      user:     "%default_db_slave_user%"
                      password: "%default_db_slave_password%"
                  slave2:
                      host:     "%default_db_slave2_host%"
                      port:     "%default_db_slave_port%"
                      dbname:   "%default_db_slave_name%"
                      user:     "%default_db_slave_user%"
                      password: "%default_db_slave_password%"
  </code></pre>
  
  <p>I would like to add weights for slaves, because they hardware is not equal, some of them are more productive, some less.
  Also I would like to inject memcache service (or inject params for creating cache service object) for putting temporarely dns which are overloaded by requests and give them chance to back to normal.
  For example, I want to inject weight param for slaves following way:</p>
  
  <pre><code>                slave1:
                      host:     "%default_db_slave1_host%"
                      port:     "%default_db_slave_port%"
                      dbname:   "%default_db_slave_name%"
                      user:     "%default_db_slave_user%"
                      password: "%default_db_slave_password%"
                      weight: "%default_db_slave1_weight%"
                  slave2:
                      host:     "%default_db_slave2_host%"
                      port:     "%default_db_slave_port%"
                      dbname:   "%default_db_slave_name%"
                      user:     "%default_db_slave_user%"
                      password: "%default_db_slave_password%"
                      weight: "%default_db_slave2_weight%"
  </code></pre>
  
  <p>When I add this option, I receive an error</p>
  
  <p><code>InvalidConfigurationException in ArrayNode.php line 317:
  Unrecognized option "weight" under "doctrine.dbal.connections.default.slaves.slave1"</code></p>
  
  <p>I don't know how to do it. I have just one idea, transfer all these params via Driver options,something like this</p>
  
  <pre><code>            logging:        "%kernel.debug%"
              profiling:      "%kernel.debug%"
              wrapper_class:  AppBundle\Connection\AppMasterSlaveConnection
              options:
                  slave1: 5
                  slave2: 25
                  slave3: 45
                  slave4: 25
                  cache: '%memcached_db%'
              mapping_types:
                  enum: string
              slaves:
                  slave1:
  </code></pre>
  
  <p>But it looks awful.</p>
  
  <p>Help me please.</p>