Though it's explained in the article provided by Qoop, I must admit that the explanation is a bit vague so I'm going to elaborate in case it helps you.
First off, in your app/config/config.php
include the following line.
// app/config/config.php
$loader->import('my_custom_parameters.php');
create the file my_custom_parameters.php
(documentation's example, I'll provide mine later on).
// app/config/my_custom_parameters.php
include_once('/path/to/drupal/sites/default/settings.php');
$container->setParameter('drupal.database.url', $db_url);
In the documentation's example there's another import in case you want your settings to be stored somewhere else. It's not mandatory to do so and you can include the variables directly in parameters.php
if you like.
For simplicity, I'm going to get rid of the include_once
and I'm going to modify the credentials directly.
// app/config/my_custom_parameters.php
$container->setParameter('database_name', 'the_db_I_want');
$container->setParameter('database_user', 'the_user_I_want');
$container->setParameter('database_password', 'the_pass_I_want');
As you can see, you can override as many parameters as you want.
UPDATE
You can also try this (haven't tested but think will work):
// app/config/my_custom_parameters.php
include_once('/path/to/where/people/can/modify/settings.php');
$container->loadFromExtension('doctrine', array(
'orm' => array(
'auto_generate_proxy_classes' => $variable_from_settings_php,
'default_entity_manager' => $another_variable_from_settins_php,
'entity_managers' => array(
'default' => array('mappings' => array('MyApp' => array('type' => 'staticphp')), 'class_metadata_factory_name' => 'Doctrine\\ORM\\Mapping\\StaticClassMetadataFactory')
)
),
'dbal' => array(
'default_connection' => 'default',
'connections' => array(
'default' => array('host' => 'from_user_config.db', 'logging' => true),
'read' => array('host' => 'from_user_config.db_read', 'logging' => true)
)
)
I'm using the code you provided. You can use the configuration you like. I've added some dummy variables that could be loaded from the file imported as parameter values just to show you that, in theory, you could do something similar.
As you can read in the documentation (the part talking about setting up the bd, 'Configuring the Database' is called):
Defining the configuration via parameters.yml is just a convention.
The parameters defined in that file are referenced by the main
configuration file when setting up Doctrine
Give it a try and let me know if it works.
Hope it's clearer.