/**
  * Merge facts from one relationship to the current object
  *
  * @param \Gedcomx\Common\ExtensibleData $relationship
  */
 public function embed(ExtensibleData $relationship)
 {
     if ($relationship->motherFacts != null) {
         if ($this->motherFacts == null) {
             $this->motherFacts = array();
         }
         $this->motherFacts = array_merge($this->motherFacts, $relationship->motherFacts);
     }
     if ($relationship->fatherFacts != null) {
         if ($this->fatherFacts == null) {
             $this->fatherFacts = array();
         }
         $this->fatherFacts = array_merge($this->fatherFacts, $relationship->fatherFacts);
     }
     parent::embed($relationship);
 }
Exemple #2
0
 /**
  * Embed the specified person into this one.
  *
  * @param ExtensibleData $person assumes \Gedcomx\Conclusion\Person or a subclass
  */
 public function embed(ExtensibleData $person)
 {
     if ($this->private == null) {
         $this->private = $person->isPrivate();
     }
     $this->living = $this->living == null ? $person->isLiving() : $this->living;
     $this->principal = $this->principal == null ? $person->principal : $this->principal;
     $this->gender = $this->gender == null ? $person->gender : $this->gender;
     if ($this->displayExtension != null && $person->displayExtension != null) {
         $this->displayExtension->embed($person->getDisplayExtension());
     } else {
         if ($person->displayExtension != null) {
             $this->displayExtension = $person->displayExtension;
         }
     }
     if ($person->names != null) {
         if ($this->names == null) {
             $this->names = array();
         }
         $this->names = array_merge($this->names, $person->names);
     }
     if ($person->facts != null) {
         if ($this->facts == null) {
             $this->facts = array();
         }
         $this->facts = array_merge($this->facts, $person->facts);
     }
     if ($person->fields != null) {
         if ($this->fields == null) {
             $this->fields = array();
         }
         $this->fields = array_merge($this->fields, $person->facts);
     }
     parent::embed($person);
 }
Exemple #3
0
 /**
  * Writes the contents of this Event to an XML writer. The startElement is expected to be already provided.
  *
  * @param \XMLWriter $writer The XML writer.
  */
 public function writeXmlContents(\XMLWriter $writer)
 {
     if ($this->type) {
         $writer->writeAttribute('type', $this->type);
     }
     parent::writeXmlContents($writer);
     if ($this->date) {
         $writer->startElementNs('gx', 'date', null);
         $this->date->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->place) {
         $writer->startElementNs('gx', 'place', null);
         $this->place->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->roles) {
         foreach ($this->roles as $i => $x) {
             $writer->startElementNs('gx', 'role', null);
             $x->writeXmlContents($writer);
             $writer->endElement();
         }
     }
 }
 /**
  * Writes the contents of this PlaceDescription to an XML writer. The startElement is expected to be already
  * provided.
  *
  * @param \XMLWriter $writer The XML writer.
  */
 public function writeXmlContents(\XMLWriter $writer)
 {
     if ($this->type) {
         $writer->writeAttribute('type', $this->type);
     }
     parent::writeXmlContents($writer);
     if ($this->names) {
         foreach ($this->names as $i => $x) {
             $writer->startElementNs('gx', 'name', null);
             $x->writeXmlContents($writer);
             $writer->endElement();
         }
     }
     if ($this->temporalDescription) {
         $writer->startElementNs('gx', 'temporalDescription', null);
         $this->temporalDescription->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->latitude) {
         $writer->startElementNs('gx', 'latitude', null);
         $writer->text($this->latitude);
         $writer->endElement();
     }
     if ($this->longitude) {
         $writer->startElementNs('gx', 'longitude', null);
         $writer->text($this->longitude);
         $writer->endElement();
     }
     if ($this->spatialDescription) {
         $writer->startElementNs('gx', 'spatialDescription', null);
         $this->spatialDescription->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->jurisdiction) {
         $writer->startElementNs('gx', 'jurisdiction', null);
         $this->jurisdiction->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->displayExtension) {
         $writer->startElementNs('gx', 'display', null);
         $this->displayExtension->writeXmlContents($writer);
         $writer->endElement();
     }
 }
Exemple #5
0
 /**
  * Writes the contents of this Relationship to an XML writer. The startElement is expected to be already provided.
  *
  * @param \XMLWriter $writer The XML writer.
  */
 public function writeXmlContents(\XMLWriter $writer)
 {
     if ($this->type) {
         $writer->writeAttribute('type', $this->type);
     }
     parent::writeXmlContents($writer);
     if ($this->person1) {
         $writer->startElementNs('gx', 'person1', null);
         $this->person1->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->person2) {
         $writer->startElementNs('gx', 'person2', null);
         $this->person2->writeXmlContents($writer);
         $writer->endElement();
     }
     if ($this->facts) {
         foreach ($this->facts as $i => $x) {
             $writer->startElementNs('gx', 'fact', null);
             $x->writeXmlContents($writer);
             $writer->endElement();
         }
     }
     if ($this->fields) {
         foreach ($this->fields as $i => $x) {
             $writer->startElementNs('gx', 'field', null);
             $x->writeXmlContents($writer);
             $writer->endElement();
         }
     }
 }