public function get($name)
    {
        // get from cache
        if (isset($this->pool[$name])) {
            return $this->pool[$name];
        }
        
        // check if connection exists
        if (!isset($this->configuration[$name])) {
            throw new Exception('Connection with name ' . $name . ' not found');
        }
        
        // check if dsn exists
        if (!isset($this->configuration[$name]['dsn'])) {
            $this->configuration[$name]['dsn'] = null;
        }
        
        // check if connect options exists
        if (empty($this->configuration[$name]['connectOptions'])) {
            $this->configuration[$name]['connectOptions'] = null;
        }
        
        // init client
        $client = new Client(
            $this->configuration[$name]['dsn'],
            $this->configuration[$name]['connectOptions']
        );
        
        if (isset($this->configuration[$name]['mapping'])) {
            $client->map($this->configuration[$name]['mapping']);
        }
        
        if (isset($this->configuration[$name]['defaultDatabase'])) {
            $client->useDatabase($this->configuration[$name]['defaultDatabase']);
        }
        
        $this->pool[$name] = $client;
        
        return $client;
    }
public function get($name)
    {
        // get from cache
        if (isset($this->pool[$name])) {
            return $this->pool[$name];
        }
        
        // check if connection exists
        if (!isset($this->configuration[$name])) {
            throw new Exception('Connection with name ' . $name . ' not found');
        }
        
        // check if dsn exists
        if (!isset($this->configuration[$name]['dsn'])) {
            $this->configuration[$name]['dsn'] = null;
        }
        
        // check if connect options exists
        if (empty($this->configuration[$name]['connectOptions'])) {
            $this->configuration[$name]['connectOptions'] = null;
        }
        
        // init client
        $client = new Client(
            $this->configuration[$name]['dsn'],
            $this->configuration[$name]['connectOptions']
        );
        
        if (isset($this->configuration[$name]['mapping'])) {
            $client->map($this->configuration[$name]['mapping']);
        }
        
        if (isset($this->configuration[$name]['defaultDatabase'])) {
            $client->useDatabase($this->configuration[$name]['defaultDatabase']);
        }
        
        $this->pool[$name] = $client;
        
        return $client;
    }
public function get ( $ name ) { // get from cache if ( isset ( $ this -> pool [ $ name ] ) ) { return $ this -> pool [ $ name ] ; } // check if connection exists if ( ! isset ( $ this -> configuration [ $ name ] ) ) { throw new Exception ( 'Connection with name ' . $ name . ' not found' ) ; } // check if dsn exists if ( ! isset ( $ this -> configuration [ $ name ] [ 'dsn' ] ) ) { $ this -> configuration [ $ name ] [ 'dsn' ] = null ; } // check if connect options exists if ( empty ( $ this -> configuration [ $ name ] [ 'connectOptions' ] ) ) { $ this -> configuration [ $ name ] [ 'connectOptions' ] = null ; } // init client $ client = new Client ( $ this -> configuration [ $ name ] [ 'dsn' ] , $ this -> configuration [ $ name ] [ 'connectOptions' ] ) ; if ( isset ( $ this -> configuration [ $ name ] [ 'mapping' ] ) ) { $ client -> map ( $ this -> configuration [ $ name ] [ 'mapping' ] ) ; } if ( isset ( $ this -> configuration [ $ name ] [ 'defaultDatabase' ] ) ) { $ client -> useDatabase ( $ this -> configuration [ $ name ] [ 'defaultDatabase' ] ) ; } $ this -> pool [ $ name ] = $ client ; return $ client ; }
Get instance of connection

@param string $name connection identifier

@return Client

@throws Exception
Get instance of connection