Doctrine 2 PDO Object
Where, oh where, is that pesky Doctrine 2 PDO object…
Doctrine actually uses a base class called \Doctrine\DBAL\Driver\PDOConnection which extends the native PHP PDO class. It’s used by all PDO-based drivers as the common database connection interface.
Code #
Access to the \Doctrine\DBAL\Driver\PDOConnection instance can be gained through the Doctrine\ORM\EntityManager instance.
<?php
/* @var \Doctrine\DBAL\Driver\PDOConnection $pdo */
$pdo = $entityManager->getConnection()->getWrappedConnection();