public function getReadConnection(Server $preferredServer = null) : IConnection
    {
        if ($preferredServer !== null) {
            $this->addServer('custom', $preferredServer);
            $this->setReadConnection($preferredServer);
        } elseif ($this->readConnection == null) {
            $this->setReadConnection();
        }

        return $this->readConnection;
    }
public function getReadConnection(Server $preferredServer = null) : IConnection
    {
        if ($preferredServer !== null) {
            $this->addServer('custom', $preferredServer);
            $this->setReadConnection($preferredServer);
        } elseif ($this->readConnection == null) {
            $this->setReadConnection();
        }

        return $this->readConnection;
    }
public function getReadConnection ( Server $ preferredServer = null ) : IConnection { if ( $ preferredServer !== null ) { $ this -> addServer ( 'custom' , $ preferredServer ) ; $ this -> setReadConnection ( $ preferredServer ) ; } elseif ( $ this -> readConnection == null ) { $ this -> setReadConnection ( ) ; } return $ this -> readConnection ; }
Gets the connection used for read queries

@param Server $preferredServer The preferred server to use
@return IConnection The connection to use for reads
@throws RuntimeException Thrown if the connection pool wasn't configured correctly
Gets the connection used for read queries