Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Doctrine MasterSlaveConnection beginTransaction connects to master but does NOT call parent method

View NewMasterSlaveConnection.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
<?php
<?php
class NewMasterSlaveConnection
{
public function beginTransaction()
{
$this->connect('master');
// *** Copied from the parent method except don't connect again ***
++$this->_transactionNestingLevel;
$logger = $this->_config->getSQLLogger();
if ($this->_transactionNestingLevel == 1) {
if ($logger) {
$logger->startQuery('"START TRANSACTION"');
}
$this->_conn->beginTransaction();
if ($logger) {
$logger->stopQuery();
}
} else if ($this->_nestTransactionsWithSavepoints) {
if ($logger) {
$logger->startQuery('"SAVEPOINT"');
}
$this->createSavepoint($this->_getNestedTransactionSavePointName());
if ($logger) {
$logger->stopQuery();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.