( ):
$databaseManager = new sfDatabaseManager ( $this->configuration );
Doctrine_Manager::connection ()->setAttribute ( Doctrine_Core::ATTR_AUTO_FREE_QUERY_OBJECTS, true );
$dbOptions = Doctrine_Manager::connection ()->getManager ()->getConnection ( 'doctrine' )->getOptions ();
$dbDsn = $dbOptions['dsn'];
$dbDsnArr = explode ( ';', $dbDsn );
$dbHost = str_replace ( 'mysql:host=', '', $dbDsnArr[0] );
$dbName = str_replace ( 'dbname=', '', $dbDsnArr[1] );
$dbUn = $dbOptions['username'];
$dbPw = $dbOptions['password'];
, DSN :
dsn: 'mysql: host = somedomain; dbname = dbname'
This code allows you to get information about connecting to the database of any connection, so it will work for several connections.
Hope this helps ...
source
share