|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace FamilyTree365\LaravelGedcom\Utils\Exporter; |
|
4
|
|
|
|
|
5
|
|
|
use FamilyTree365\LaravelGedcom\Models\Subn as MSubn; |
|
6
|
|
|
|
|
7
|
|
|
class Subn |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Gedcom\Record\Subn $subn |
|
11
|
|
|
* String $group |
|
12
|
|
|
* Integer $group_id. |
|
13
|
|
|
*/ |
|
14
|
|
|
public static function read($conn, $subn, $subm_ids) |
|
15
|
|
|
{ |
|
16
|
|
|
if ($subn == null || is_array($subn)) { |
|
17
|
|
|
return; |
|
18
|
|
|
} |
|
19
|
|
|
$_subm = $subn->getSubm(); |
|
20
|
|
|
$subm = null; |
|
21
|
|
|
if (isset($subm_ids[$subm])) { |
|
22
|
|
|
$subm = $subm_ids[$_subm]; |
|
23
|
|
|
} |
|
24
|
|
|
$famf = $subn->getFamf(); |
|
25
|
|
|
$temp = $subn->getTemp(); |
|
26
|
|
|
$ance = $subn->getAnce(); |
|
27
|
|
|
$desc = $subn->getDesc(); |
|
28
|
|
|
$ordi = $subn->getOrdi(); |
|
29
|
|
|
$rin = $subn->getRin(); |
|
30
|
|
|
$record = MSubn::on($conn)->updateOrCreate(compact('subm', 'famf', 'temp', 'ance', 'desc', 'ordi', 'rin'), compact('subm', 'famf', 'temp', 'ance', 'desc', 'ordi', 'rin')); |
|
31
|
|
|
|
|
32
|
|
|
$_group = 'subn'; |
|
33
|
|
|
$_gid = $record->id; |
|
34
|
|
|
|
|
35
|
|
|
$note = $subn->getNote(); // array --- |
|
36
|
|
|
|
|
37
|
|
|
if ($note != null && count($note) > 0) { |
|
38
|
|
|
foreach ($note as $item) { |
|
39
|
|
|
\FamilyTree365\LaravelGedcom\Utils\Importer\NoteRef::read($conn, $item, $_group, $_gid); |
|
40
|
|
|
} |
|
41
|
|
|
} |
|
42
|
|
|
$chan = $subn->getChan() ?? null; // Record\Chan--- |
|
43
|
|
|
if ($chan !== null) { |
|
44
|
|
|
\FamilyTree365\LaravelGedcom\Utils\Importer\Chan::read($conn, $chan, $_group, $_gid); |
|
45
|
|
|
} |
|
46
|
|
|
} |
|
47
|
|
|
} |
|
48
|
|
|
|