Skip to content

Commit 3f892b3

Browse files
Merge pull request #29 from familytree365/fix/gedcom_import_export
Fix error export and fill name, birthday, deathday, burial day, gid, …
2 parents a7be7ed + a4f894e commit 3f892b3

File tree

2 files changed

+62
-11
lines changed

2 files changed

+62
-11
lines changed

src/Record/Indi.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class Indi extends \Gedcom\Record implements Noteable, Objectable, Sourceable
2727
*/
2828
protected $id;
2929

30+
/**
31+
* @var string
32+
*/
33+
protected $gid;
34+
3035
/**
3136
* @var string
3237
*/
@@ -201,6 +206,26 @@ public function getId()
201206
return $this->id;
202207
}
203208

209+
/**
210+
* @param string $id
211+
*
212+
* @return Indi
213+
*/
214+
public function setGid($gid = '')
215+
{
216+
$this->gid = $gid;
217+
218+
return $this;
219+
}
220+
221+
/**
222+
* @return string
223+
*/
224+
public function getGid()
225+
{
226+
return $this->gid;
227+
}
228+
204229
/**
205230
* @param string $uid
206231
*

src/Writer/Indi.php

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,18 @@ public static function convert(\Gedcom\Record\Indi &$indi)
2727

2828
// id
2929
$id = $indi->getId();
30-
$output = $level.' @'.$id."@ INDI\n";
30+
31+
// gid
32+
$gid = $indi->getGid();
33+
$output = $level.' @'.$gid."@ INDI\n";
3134

3235
// increase level after start indi
3336
$level++;
3437

35-
// name
36-
// $name = $indi->getName();
37-
// if(!empty($name)){
38-
// $output.=$level." NAME ".$name."\n";
39-
// }
40-
41-
// chan
42-
$chan = $indi->getChan();
43-
if (!empty($chan)) {
44-
$output .= $level.' CHAN '.$chan."\n";
38+
// uid
39+
$uid = $indi->getUid();
40+
if (!empty($uid)) {
41+
$output .= $level.' _UID '.$uid."\n";
4542
}
4643

4744
// $attr
@@ -118,6 +115,27 @@ public static function convert(\Gedcom\Record\Indi &$indi)
118115
$output .= $level.' SEX '.$sex."\n";
119116
}
120117

118+
// $birthday
119+
$birthday = $indi->getBirthday();
120+
if (!empty($birthday)) {
121+
$output .= $level.' BIRT '."\n";
122+
$output .= ($level+1).' DATE '.$birthday."\n";
123+
}
124+
125+
// $deathday
126+
$deathday = $indi->getDeathday();
127+
if (!empty($deathday)) {
128+
$output .= $level.' DEAT '."\n";
129+
$output .= ($level+1).' DATE '.$deathday."\n";
130+
}
131+
132+
// $burialday
133+
$burialday = $indi->getBurialday();
134+
if (!empty($burialday)) {
135+
$output .= $level.' BURI '."\n";
136+
$output .= ($level+1).' DATE '.$burialday."\n";
137+
}
138+
121139
// $rin
122140
$rin = $indi->getRin();
123141
if (!empty($rin)) {
@@ -207,6 +225,14 @@ public static function convert(\Gedcom\Record\Indi &$indi)
207225
}
208226
}
209227

228+
// chan
229+
$chan = $indi->getChan();
230+
if (!empty($chan)) {
231+
$output .= $level.' CHAN '."\n";
232+
$output .= ($level+1).' DATE '.$chan[0]."\n";
233+
$output .= ($level+1).' TIME '.$chan[1]."\n";
234+
}
235+
210236
// Bapl
211237
// Currently Bapl is empty
212238
// $bapl = $indi->getBapl();

0 commit comments

Comments
 (0)