/** * Merges given data with current object * * @param FamilySearchPlatform|ExtensibleData $gedcomx Assumes Gedcomx\Gedcomx or a subclass */ public function embed(ExtensibleData $gedcomx) { $childRelationships = $gedcomx->getChildAndParentsRelationships(); if ($childRelationships != null) { foreach ($childRelationships as $chr) { $found = false; if ($chr->getId() != null) { if ($this->getChildAndParentsRelationships() != null) { foreach ($this->getChildAndParentsRelationships() as $target) { if ($chr->getId() == $target->getId()) { $target->embed($chr); $found = true; break; } } } } if (!$found) { $this->addChildAndParentsRelationship($chr); } } } $discussions = $gedcomx->getDiscussions(); if ($discussions != null) { foreach ($discussions as $d) { $found = false; if ($d->getId() != null) { if ($this->getDiscussions() != null) { foreach ($this->getDiscussions() as $target) { if ($d->getId() == $target->getId()) { $target->embed($d); $found = true; break; } } } } if (!$found) { $this->addDiscussion($d); } } } parent::embed($gedcomx); }