Unverified Commit 334e298b authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #4092 from morozov/remove-connection-is-connected

Remove Connection::$isConnected
parents 17389361 2cedd229
...@@ -98,13 +98,6 @@ class Connection implements DriverConnection ...@@ -98,13 +98,6 @@ class Connection implements DriverConnection
/** @var ExpressionBuilder */ /** @var ExpressionBuilder */
protected $_expr; protected $_expr;
/**
* Whether or not a connection has been established.
*
* @var bool
*/
private $isConnected = false;
/** /**
* The current auto-commit mode of this connection. * The current auto-commit mode of this connection.
* *
...@@ -192,8 +185,7 @@ class Connection implements DriverConnection ...@@ -192,8 +185,7 @@ class Connection implements DriverConnection
$this->params = $params; $this->params = $params;
if (isset($params['pdo'])) { if (isset($params['pdo'])) {
$this->_conn = $params['pdo']; $this->_conn = $params['pdo'];
$this->isConnected = true;
unset($this->params['pdo']); unset($this->params['pdo']);
} }
...@@ -356,7 +348,7 @@ class Connection implements DriverConnection ...@@ -356,7 +348,7 @@ class Connection implements DriverConnection
*/ */
public function connect() public function connect()
{ {
if ($this->isConnected) { if ($this->_conn !== null) {
return false; return false;
} }
...@@ -364,8 +356,7 @@ class Connection implements DriverConnection ...@@ -364,8 +356,7 @@ class Connection implements DriverConnection
$user = $this->params['user'] ?? null; $user = $this->params['user'] ?? null;
$password = $this->params['password'] ?? null; $password = $this->params['password'] ?? null;
$this->_conn = $this->_driver->connect($this->params, $user, $password, $driverOptions); $this->_conn = $this->_driver->connect($this->params, $user, $password, $driverOptions);
$this->isConnected = true;
$this->transactionNestingLevel = 0; $this->transactionNestingLevel = 0;
...@@ -524,7 +515,7 @@ class Connection implements DriverConnection ...@@ -524,7 +515,7 @@ class Connection implements DriverConnection
$this->autoCommit = $autoCommit; $this->autoCommit = $autoCommit;
// Commit all currently active transactions if any when switching auto-commit mode. // Commit all currently active transactions if any when switching auto-commit mode.
if ($this->isConnected !== true || $this->transactionNestingLevel === 0) { if ($this->_conn === null || $this->transactionNestingLevel === 0) {
return; return;
} }
...@@ -689,7 +680,7 @@ class Connection implements DriverConnection ...@@ -689,7 +680,7 @@ class Connection implements DriverConnection
*/ */
public function isConnected() public function isConnected()
{ {
return $this->isConnected; return $this->_conn !== null;
} }
/** /**
...@@ -771,8 +762,6 @@ class Connection implements DriverConnection ...@@ -771,8 +762,6 @@ class Connection implements DriverConnection
public function close() public function close()
{ {
$this->_conn = null; $this->_conn = null;
$this->isConnected = false;
} }
/** /**
......
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