Example #1
0
 /**
  * Write document metadata to the database.
  *
  * @param Metadata $metadata A Metadata object.
  * @return Document $this
  */
 public function writeMetadata($metadata)
 {
     $metaxml = $metadata->getAsXML();
     try {
         $params = array('uri' => $this->uri, 'category' => 'metadata', 'format' => 'xml');
         $headers = array('Content-type' => 'application/xml');
         $request = new RESTRequest('PUT', 'documents', $params, $metaxml, $headers);
         $this->response = $this->client->send($request);
     } catch (\Exception $e) {
         $this->logger->error($e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine());
     }
     return $this;
 }