コード例 #1
0
 /**
  * Adds target groups, links and fields to document
  * @param $document_input
  * @param $document_id
  * @return mixed
  */
 private function addContentToDocument($target_groups, $links, $fields, $document_id)
 {
     $document = $this->getById($document_id);
     $document_target_group_db_mapper = new DocumentTargetGroupDBMapper();
     $document_link_db_mapper = new LinkDBMapper();
     $document_field_db_mapper = new DocumentFieldValueDBMapper();
     // Store current document id and timestamp
     $id = $document->getId();
     $timestamp = $document->getTimestamp();
     // Add all target groups, links and fields
     $document_target_group_db_mapper->addMultiple($target_groups, $id, $timestamp);
     $document_link_db_mapper->addMultiple($links, $id, $timestamp);
     $document_field_db_mapper->addMultiple($fields, $id, $timestamp);
     return $document_id;
 }
コード例 #2
0
 /**
  * Retrieving all links under documents
  * @param $document
  * @return array
  */
 public static function getLinks($document)
 {
     $link_mapper = new LinkDBMapper();
     $links = $link_mapper->getLinksByDocumentId($document->getId(), $document->getTimestamp());
     $link_array = [];
     foreach ($links as $link) {
         array_push($link_array, $link->toArray());
     }
     return $link_array;
 }