set_relation() public method

Set a relation according to the given parameters.
public set_relation ( integer $source_site_id, integer $target_site_id, integer $source_content_id, integer $target_content_id, string $type = 'post' ) : boolean
$source_site_id integer Source blog ID.
$target_site_id integer Target blog ID.
$source_content_id integer Source post ID or term taxonomy ID.
$target_content_id integer Target post ID or term taxonomy ID.
$type string Content type.
return boolean
 /**
  * @param array $existing
  * @param int   $source_term_taxonomy_id
  * @param int   $target_site_id
  * @param int   $target_term_taxonomy_id
  *
  * @return bool
  */
 private function update_terms(array $existing, $source_term_taxonomy_id, $target_site_id, $target_term_taxonomy_id)
 {
     // There's nothing to do here
     if (-1 === $target_term_taxonomy_id) {
         return TRUE;
     }
     if (isset($existing[$target_site_id]) && $existing[$target_site_id] === $target_term_taxonomy_id) {
         return TRUE;
     }
     $translation_ids = $this->content_relations->get_translation_ids($this->current_site_id, $target_site_id, $source_term_taxonomy_id, $target_term_taxonomy_id, 'term');
     if ($translation_ids['ml_source_blogid'] !== $this->current_site_id) {
         $target_site_id = $this->current_site_id;
         if (0 !== $target_term_taxonomy_id) {
             $target_term_taxonomy_id = $source_term_taxonomy_id;
         }
     }
     // Delete a relation
     if (0 === $target_term_taxonomy_id) {
         return $this->content_relations->delete_relation($translation_ids['ml_source_blogid'], $target_site_id, $translation_ids['ml_source_elementid'], 0, 'term');
     }
     return $this->content_relations->set_relation($translation_ids['ml_source_blogid'], $target_site_id, $translation_ids['ml_source_elementid'], $target_term_taxonomy_id, 'term');
 }
 /**
  * set the source id of the element
  *
  * @param   int $source_content_id ID of current element
  * @param   int $remote_site_id    ID of remote site
  * @param   int $remote_content_id ID of remote content
  *
  * @return  void
  */
 public function set_linked_element($source_content_id, $remote_site_id, $remote_content_id)
 {
     $this->content_relations->set_relation($this->source_site_id, $remote_site_id, $source_content_id, $remote_content_id, 'post');
 }
 /**
  * Connects the current post with an existing remote one.
  *
  * @return bool Whether or not the relationship was updated successfully.
  */
 private function connect_existing_post()
 {
     $this->disconnect_post();
     return $this->content_relations->set_relation($this->context->source_site_id(), $this->context->remote_site_id(), $this->context->source_post_id(), $this->context->new_post_id(), 'post');
 }