I accept Doctrine in existing software and would like Doctrine to share the same PDO connections as the old code.
I know that you can say that using Doctrine uses an established connection, for example:
$em = EntityManager::create(['pdo' => $pdo], $ormConfiguration);
I could not find the right combination for connecting master / slave. This is what I expected from work:
$em = EntityManager::create( [ 'wrapperClass' => \Doctrine\DBAL\Connections\MasterSlaveConnection::class, 'master' => ['pdo' => $pdoMaster], 'slaves' => [ ['pdo' => $pdoSlave] ] ], $ormConfiguration );
This causes the following error:
Disabling the Doctrine \ DBAL \ DBALException exception with the message "Driver" or "driverClass" is required if the PDO instance is not specified in DriverManager :: getConnection ().
Reading the code, it seems that using established connections with Doctrine using Master / Slave is not supported. But I'm not sure. Most documents do not cover details about using established connections.
source share