Commit cfddafc9 authored by randomonkey's avatar randomonkey

Fix undefined notices within MasterSlaveConnection

To fix the following notice-level errors:

Notice: Undefined property: Doctrine\DBAL\Connections\MasterSlaveConnection::$_conn in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php line 154
Notice: Undefined index: slave in vendor/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php line 165
parent 9e795469
...@@ -151,7 +151,7 @@ class MasterSlaveConnection extends Connection ...@@ -151,7 +151,7 @@ class MasterSlaveConnection extends Connection
// If we have a connection open, and this is not an explicit connection // If we have a connection open, and this is not an explicit connection
// change request, then abort right here, because we are already done. // change request, then abort right here, because we are already done.
// This prevents writes to the slave in case of "keepSlave" option enabled. // This prevents writes to the slave in case of "keepSlave" option enabled.
if ($this->_conn && !$requestedConnectionChange) { if (isset($this->_conn) && $this->_conn && !$requestedConnectionChange) {
return false; return false;
} }
...@@ -162,7 +162,7 @@ class MasterSlaveConnection extends Connection ...@@ -162,7 +162,7 @@ class MasterSlaveConnection extends Connection
$forceMasterAsSlave = true; $forceMasterAsSlave = true;
} }
if ($this->connections[$connectionName]) { if (isset($this->connections[$connectionName]) && $this->connections[$connectionName]) {
$this->_conn = $this->connections[$connectionName]; $this->_conn = $this->connections[$connectionName];
if ($forceMasterAsSlave && ! $this->keepSlave) { if ($forceMasterAsSlave && ! $this->keepSlave) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment