public function beginTransaction()
{
if (0 !== $this->getTransactionNestingLevel()) {
return parent::beginTransaction();
}
$attempt = 0;
$retry = true;
while ($retry) {
$retry = false;
try {
parent::beginTransaction();
} catch (\Exception $e) {
if ($this->canTryAgain($attempt, true) && $this->_driver->isGoneAwayException($e)) {
$this->close();
if (0 < $this->getTransactionNestingLevel()) {
$this->resetTransactionNestingLevel();
}
++$attempt;
$retry = true;
} else {
throw $e;
}
}
}
}