Example #1
0
 /**
  * Merges data from provided object with current object
  *
  * @param ExtensibleData $conclusion
  */
 protected function embed(ExtensibleData $conclusion)
 {
     if ($this->lang != null) {
         $this->lang = $conclusion->lang;
     }
     if ($this->confidence != null) {
         $this->confidence = $conclusion->confidence;
     }
     if ($this->attribution != null) {
         $this->attribution = $conclusion->attribution;
     }
     if ($this->analysis != null) {
         $this->analysis = $conclusion->analysis;
     }
     if ($conclusion->notes != null) {
         if ($this->notes != null) {
             $this->notes = array();
         }
         $this->notes = array_merge($this->notes, $conclusion->notes);
     }
     if ($conclusion->sources != null) {
         if ($this->sources == null) {
             $this->sources = array();
         }
         $this->sources = array_merge($this->sources, $conclusion->sources);
     }
     parent::embed($conclusion);
 }
Example #2
0
 /**
  * @param \Gedcomx\Common\ExtensibleData $discussion
  */
 public function embed(ExtensibleData $discussion)
 {
     $comments = $discussion->getComments();
     if ($comments != null) {
         foreach ($comments as $comment) {
             $found = false;
             if ($comment->getId() != null) {
                 if ($this->getComments() != null) {
                     foreach ($this->getComments() as $target) {
                         if ($comment->getId() == $target->getId()) {
                             $target->embed($comment);
                             $found = true;
                             break;
                         }
                     }
                 }
             }
             if (!$found) {
                 $this->addComment($comment);
             }
         }
     }
     parent::embed($discussion);
 }