Can I use Doctrine transaction together with mysql PDO statements?

From below code I expect that $query1 will be undone after Exception is
thrown. But it’s not.

try {
    PDO::exec($query1 = 'INSERT INTO foo...')
    throw new Exception();
    PDO::exec($query2 = 'INSERT INTO bar...')
} catch (/Exception $e) {
    throw $e;

You can use Doctrine and PDO together.

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.

you can use getWrappedConnection

$conn = $this->em->getConnection()->getWrappedConnection();

But I am not sure what you can static method exec with PDO:

I think you need use $conn, so you created: