从下面的代码中我预计$ query1将在Exception之后撤消 抛出。但事实并非如此。
try {
$this->em->getConnection()->beginTransaction();
PDO::exec($query1 = 'INSERT INTO foo...')
throw new Exception();
PDO::exec($query2 = 'INSERT INTO bar...')
$this->em->flush();
$this->em->getConnection()->commit();
} catch (\Exception $e) {
$this->em->getConnection()->rollBack();
throw $e;
}