You can transfer your own PDO instance to Doctrine by establishing a persistent connection yourself:
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array( PDO::ATTR_PERSISTENT => true )); $config = new \Doctrine\DBAL\Configuration(); $connectionParams = array( 'dbname' => 'mydb', 'user' => 'user', 'password' => 'secret', 'host' => 'localhost', 'pdo' => $dbh, ); $conn = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
Be sure to familiarize yourself with the consequences of using persistent connections with PDO: What are the disadvantages of using persistent connections in PDO
source share