yii\db\Connection::close PHP Method

close() public method

It does nothing if the connection is already closed.
public close ( )
    public function close()
    {
        if ($this->pdo !== null) {
            Yii::trace('Closing DB connection: ' . $this->dsn, __METHOD__);
            $this->pdo = null;
            $this->_schema = null;
            $this->_transaction = null;
        }
        if ($this->_slave) {
            $this->_slave->close();
            $this->_slave = null;
        }
    }

Usage Example

 protected function tearDown()
 {
     if ($this->_db) {
         $this->_db->close();
     }
     $this->destroyApplication();
 }
All Usage Examples Of yii\db\Connection::close