Skip to content

Commit 670ea31

Browse files
author
punitcis
committed
changes for insert in chunks
1 parent 6d01c21 commit 670ea31

File tree

7 files changed

+568
-12
lines changed

7 files changed

+568
-12
lines changed

src/Utils/Importer/Indi/Alia.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ public static function read($conn, $item, $group = '', $group_id = 0)
2020
$aliaData [] = $data;
2121
}
2222
}
23-
PersonAlia::insert($aliaData);
23+
PersonAlia::on($conn)->insert($aliaData);
2424
}
2525
}

src/Utils/Importer/Indi/Even.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public static function read($conn, $events, $person, $obje_ids = [])
136136
['adop_famc' , $adop_famc],
137137
['birt_famc' , $birt_famc]
138138
];
139-
$check = PersonEvent::where($key)->first();
139+
$check = PersonEvent::on($conn)->where($key)->first();
140140
if(empty($check)){
141141
$data = [
142142
'person_id' => $person_id,
@@ -159,7 +159,7 @@ public static function read($conn, $events, $person, $obje_ids = [])
159159
}
160160
}
161161
}
162-
PersonEvent::insert($eventData);
162+
PersonEvent::on($conn)->insert($eventData);
163163
$new = new Even;
164164
$new->otherField($conn,$events,$person);
165165
}
@@ -285,7 +285,7 @@ public static function otherField($conn, $events, $person){
285285
['birt_famc' , $birt_famc],
286286
];
287287

288-
$record = PersonEvent::where($key)->first();
288+
$record = PersonEvent::on($conn)->where($key)->first();
289289

290290
$_group = 'indi_even';
291291
$_gid = $record->id;

src/Utils/Importer/Indi/Subm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ public static function read($conn, $item, $group = '', $group_id = 0, $subm_ids)
2626
}
2727
}
2828

29-
PersonSubm::insert($record);
29+
PersonSubm::on($conn)->insert($record);
3030
}
3131
}

src/Utils/ParentData.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ParentData
3838

3939
public static function getPerson($conn, $individuals, $obje_ids)
4040
{
41-
$data = [];
41+
$ParentData = [];
4242
foreach($individuals as $k=>$individual){
4343
$g_id = $individual->getId();
4444
$name = '';
@@ -111,15 +111,14 @@ public static function getPerson($conn, $individuals, $obje_ids)
111111
if(empty($check)){
112112
$value = ['name'=>$name,'givn'=>$givn,'surn'=>$surn,'sex'=>$sex,'uid'=>$uid,'rin'=>$rin,'resn'=>$resn,'rfn'=>$rfn,'afn'=>$afn];
113113

114-
$data[] = $value;
114+
$ParentData[] = $value;
115115
}
116116
// $person = Person::on($conn)->updateOrCreate($key,$value);
117117
// otherFields::insertOtherFields($conn,$individual,$obje_ids,$person);
118118
}
119-
120-
foreach (array_chunk($data, 200) as $chunk)
119+
foreach (array_chunk($ParentData, 200) as $chunk)
121120
{
122-
Person::insert($chunk->toArray());
121+
Person::on($conn)->insert($chunk->toArray());
123122
}
124123
otherFields::insertOtherFields($conn,$individuals,$obje_ids);
125124
}

0 commit comments

Comments
 (0)