public function connect()
    {
        if ($this->isConnected() === false) {
            try {
                if (isset($this->servers['all']) === true) {
                    $dsn = $this->providerDatabase->getDsn($this->servers['all']);
                    $this->servers['all']['link'] = new \PDO($dsn, $this->servers['all']['user'], $this->servers['all']['pass']);
                } else {
                    $dsn = $this->providerDatabase->getDsn($this->servers['read']);
                    $this->servers['read']['link'] = new \PDO($dsn, $this->servers['read']['user'], $this->servers['read']['pass']);
                    $dsn = $this->providerDatabase->getDsn($this->servers['write']);
                    $this->servers['write']['link'] = new \PDO($dsn, $this->servers['write']['user'], $this->servers['write']['pass']);
                }
            } catch (\PDOException $e) {
                throw new ExternalLink('can\'t connect to database (' . $e->getMessage() . ')');
            }
        }
    }
public function connect()
    {
        if ($this->isConnected() === false) {
            try {
                if (isset($this->servers['all']) === true) {
                    $dsn = $this->providerDatabase->getDsn($this->servers['all']);
                    $this->servers['all']['link'] = new \PDO($dsn, $this->servers['all']['user'], $this->servers['all']['pass']);
                } else {
                    $dsn = $this->providerDatabase->getDsn($this->servers['read']);
                    $this->servers['read']['link'] = new \PDO($dsn, $this->servers['read']['user'], $this->servers['read']['pass']);
                    $dsn = $this->providerDatabase->getDsn($this->servers['write']);
                    $this->servers['write']['link'] = new \PDO($dsn, $this->servers['write']['user'], $this->servers['write']['pass']);
                }
            } catch (\PDOException $e) {
                throw new ExternalLink('can\'t connect to database (' . $e->getMessage() . ')');
            }
        }
    }
public function connect ( ) { if ( $ this -> isConnected ( ) === false ) { try { if ( isset ( $ this -> servers [ 'all' ] ) === true ) { $ dsn = $ this -> providerDatabase -> getDsn ( $ this -> servers [ 'all' ] ) ; $ this -> servers [ 'all' ] [ 'link' ] = new \ PDO ( $ dsn , $ this -> servers [ 'all' ] [ 'user' ] , $ this -> servers [ 'all' ] [ 'pass' ] ) ; } else { $ dsn = $ this -> providerDatabase -> getDsn ( $ this -> servers [ 'read' ] ) ; $ this -> servers [ 'read' ] [ 'link' ] = new \ PDO ( $ dsn , $ this -> servers [ 'read' ] [ 'user' ] , $ this -> servers [ 'read' ] [ 'pass' ] ) ; $ dsn = $ this -> providerDatabase -> getDsn ( $ this -> servers [ 'write' ] ) ; $ this -> servers [ 'write' ] [ 'link' ] = new \ PDO ( $ dsn , $ this -> servers [ 'write' ] [ 'user' ] , $ this -> servers [ 'write' ] [ 'pass' ] ) ; } } catch ( \ PDOException $ e ) { throw new ExternalLink ( 'can\'t connect to database (' . $ e -> getMessage ( ) . ')' ) ; } } }
Connect to the database.

@throws ExternalLink if database connection can't be established
Connect to the database .