public function write($uri = null, $params = array())
    {
        $this->uri = (isset($uri)) ? (string)$uri : $this->uri;
        try {
            $params = array_merge(array('uri' => $this->uri), $params);
            $headers = array();
            if ($this->getContentType()) {
                $headers = array('Content-type' => $this->getContentType());
            }
            $request = new RESTRequest('PUT', 'documents', $params, $this->content, $headers);
            $this->response = $this->client->send($request);
        } catch(\Exception $e) {
            $this->logger->error( $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() );
            throw $e;
        }
        return $this;
    }
public function write($uri = null, $params = array())
    {
        $this->uri = (isset($uri)) ? (string)$uri : $this->uri;
        try {
            $params = array_merge(array('uri' => $this->uri), $params);
            $headers = array();
            if ($this->getContentType()) {
                $headers = array('Content-type' => $this->getContentType());
            }
            $request = new RESTRequest('PUT', 'documents', $params, $this->content, $headers);
            $this->response = $this->client->send($request);
        } catch(\Exception $e) {
            $this->logger->error( $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() );
            throw $e;
        }
        return $this;
    }
public function write ( $ uri = null , $ params = array ( ) ) { $ this -> uri = ( isset ( $ uri ) ) ? ( string ) $ uri : $ this -> uri ; try { $ params = array_merge ( array ( 'uri' => $ this -> uri ) , $ params ) ; $ headers = array ( ) ; if ( $ this -> getContentType ( ) ) { $ headers = array ( 'Content-type' => $ this -> getContentType ( ) ) ; } $ request = new RESTRequest ( 'PUT' , 'documents' , $ params , $ this -> content , $ headers ) ; $ this -> response = $ this -> client -> send ( $ request ) ; } catch ( \ Exception $ e ) { $ this -> logger -> error ( $ e -> getMessage ( ) . ' in ' . $ e -> getFile ( ) . ' on line ' . $ e -> getLine ( ) ) ; throw $ e ; } return $ this ; }
Write a document to the database.

@param string $uri A document URI.
@param array $params Optional additional parameters to pass when writing.
@return Document $this
Write a document to the database .