-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
While trying to use doctrine with persistent pdo_mysql connections, it seemed that this is not supported.
To be clear, when you pass PDO::ATTR_PERSISTENT => true as config option for connection, an exception will be raised stating that General error: PDO::ATTR_STATEMENT_CLASS cannot be used with persistent PDO instances.
After some research, i found this answer on stackoverflow suggesting to pass a pre-created PDO instance as configuration parameter like this:
$conn = array('pdo' => $dbh);`
$this->entityManager = EntityManager::create($conn, $config);
It does work and my application is able use doctrine as usual. BUT it feels strange. My understanding is that this way we fool doctrine to use pdo without the statement class (which is by the way Doctrine\DBAL\Driver\PDOStatement). Can someone please point out, if there are any risks of using doctrine like that?
I also suggest to add the corresponding info regarding persistent connection to the docs.