From 0099602841f785c3eb637db2a6e6b4800e594c21 Mon Sep 17 00:00:00 2001 From: Heru Firmansyah Date: Mon, 30 Aug 2021 06:27:21 +0800 Subject: [PATCH] Fix add family when export gedcom --- src/Record.php | 2 +- src/Record/SourRef.php | 7 +++++++ src/Writer.php | 2 +- src/Writer/Indi.php | 6 +++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Record.php b/src/Record.php index 4bb92bce..6739eb7c 100644 --- a/src/Record.php +++ b/src/Record.php @@ -77,7 +77,7 @@ public function __call($method, $args) } if (!property_exists($this, '_'.$arr)) { - throw new \Gedcom\Exception('Unknown '.$this::class.'::'.$arr); + throw new \Exception('Unknown '.$this::class.'::'.$arr); } return $this->{'_'.$arr}; diff --git a/src/Record/SourRef.php b/src/Record/SourRef.php index 35da924a..b0ec004c 100644 --- a/src/Record/SourRef.php +++ b/src/Record/SourRef.php @@ -27,4 +27,11 @@ class SourRef extends \Gedcom\Record protected $_obje = []; protected $_note = []; + + public function setSour($sour = '') + { + $this->_sour = $sour; + + return $this; + } } diff --git a/src/Writer.php b/src/Writer.php index d86737d5..72c4f684 100644 --- a/src/Writer.php +++ b/src/Writer.php @@ -73,7 +73,7 @@ public static function convert(Gedcom $gedcom, $format = self::GEDCOM55) if (!empty($sours) && count($sours) > 0) { foreach ($sours as $item) { if ($item) { - $output .= Sour::convert($item); + $output .= Sour::convert($item, 0); } } } diff --git a/src/Writer/Indi.php b/src/Writer/Indi.php index 06bc8c9e..b5884cd4 100644 --- a/src/Writer/Indi.php +++ b/src/Writer/Indi.php @@ -116,21 +116,21 @@ public static function convert(\Gedcom\Record\Indi &$indi) } // $birthday - $birthday = $indi->getBirthday(); + $birthday = $indi->getBirt(); if (!empty($birthday)) { $output .= $level.' BIRT '."\n"; $output .= ($level+1).' DATE '.$birthday."\n"; } // $deathday - $deathday = $indi->getDeathday(); + $deathday = $indi->getDeat(); if (!empty($deathday)) { $output .= $level.' DEAT '."\n"; $output .= ($level+1).' DATE '.$deathday."\n"; } // $burialday - $burialday = $indi->getBurialday(); + $burialday = $indi->getBuri(); if (!empty($burialday)) { $output .= $level.' BURI '."\n"; $output .= ($level+1).' DATE '.$burialday."\n";