php - Is it possible to use Doctrine with persistent PDO connections? -
i'm trying improve performance on volkszaehler.org implementation enabling persistent db connections. having hacked included doctrine's connection
class have pdo::attr_persistent => true
, i'm getting pdo error general error: pdo::attr_statement_class cannot used persistent pdo instances"
is there way fix this?
you pass own pdo instance doctrine, setting 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 know implications of using persistent connections pdo: what disadvantages of using persistent connection in pdo