src/Db/Pgsql/PgClient.php
private function createNewConnection($addToPool = true, $params = [])
    {
        // no idle connections were found - spin up new one
        $params = ArrayHelper::merge($this->connectionParams, $params);
        $connection = new pgConnection($params, $this->loop, $this->connector);
        if (!$addToPool || $this->autoDisconnect) {
            return $connection;
        }

        $this->connections[] = $connection;

        $connection->on('close', function() use ($connection) {
            $this->connections = array_filter($this->connections, function($c) use ($connection) {
                return $connection !== $c;
            });
            $this->connections = array_values($this->connections);
        });

        return $connection;
    }
private function createNewConnection($addToPool = true, $params = [])
    {
        // no idle connections were found - spin up new one
        $params = ArrayHelper::merge($this->connectionParams, $params);
        $connection = new pgConnection($params, $this->loop, $this->connector);
        if (!$addToPool || $this->autoDisconnect) {
            return $connection;
        }

        $this->connections[] = $connection;

        $connection->on('close', function() use ($connection) {
            $this->connections = array_filter($this->connections, function($c) use ($connection) {
                return $connection !== $c;
            });
            $this->connections = array_values($this->connections);
        });

        return $connection;
    }
Create new connection
@param bool  $addToPool
@param array $params
@return pgConnection
@deprecated Since Pool is used
@see getPool()