Doctrine2 Mutliple DBs without Symfony2?
Posted
by
ehime
on Stack Overflow
See other posts from Stack Overflow
or by ehime
Published on 2013-07-02T17:02:37Z
Indexed on
2013/07/02
17:05 UTC
Read the original article
Hit count: 364
Hey guys I know that using the Doctrinebundle in Symfony2 it is possible to instantiate multiple DB connections under Doctrine...
$connectionFactory = $this->container->get('doctrine.dbal.connection_factory');
$connection = $connectionFactory->createConnection(array(
'driver' => 'pdo_mysql',
'user' => 'foo_user',
'password' => 'foo_pass',
'host' => 'foo_host',
'dbname' => 'foo_db',
));
I'm curious if this is the case if you are using PURELY Doctrine though?, I've set up Doctrine via Composer like so...
{
"config": {
"vendor-dir": "lib/"
},
"require": {
"doctrine/orm": "2.3.4",
"doctrine/dbal": "2.3.4"
}
}
And have been looking for my ConnectionFactory
class but am not seeing it anywhere? Am I required to use Symfony2 to do this? Thanks!
© Stack Overflow or respective owner