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

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

        return $this->writeConnection;
    }
public function getWriteConnection ( Server $ preferredServer = null ) : IConnection { if ( $ preferredServer != null ) { $ this -> addServer ( 'custom' , $ preferredServer ) ; $ this -> setWriteConnection ( $ preferredServer ) ; } elseif ( $ this -> writeConnection == null ) { $ this -> setWriteConnection ( ) ; } return $ this -> writeConnection ; }
Gets the connection used for write queries

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