diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-01-01 19:22:30 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-01-01 19:22:30 +0000 |
| commit | 85fc80648e2a64d37691f365da7b2b6182b3fc1e (patch) | |
| tree | d9c1477f625173b942ff2d40b2a304735a7973bd /app | |
| parent | bf4eb5429295fac4d577af25e48680f677a30acd (diff) | |
| download | webtrees-85fc80648e2a64d37691f365da7b2b6182b3fc1e.tar.gz webtrees-85fc80648e2a64d37691f365da7b2b6182b3fc1e.tar.bz2 webtrees-85fc80648e2a64d37691f365da7b2b6182b3fc1e.zip | |
Use illuminate/database
Diffstat (limited to 'app')
| -rw-r--r-- | app/GedcomRecord.php | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/app/GedcomRecord.php b/app/GedcomRecord.php index 0ebc032042..72342c8087 100644 --- a/app/GedcomRecord.php +++ b/app/GedcomRecord.php @@ -162,11 +162,12 @@ class GedcomRecord if (!isset(self::$pending_record_cache[$tree_id])) { // Fetch all pending records in one database query self::$pending_record_cache[$tree_id] = []; - $rows = Database::prepare( - "SELECT xref, new_gedcom FROM `##change` WHERE status = 'pending' AND gedcom_id = :tree_id ORDER BY change_id" - )->execute([ - 'tree_id' => $tree_id, - ])->fetchAll(); + $rows = DB::table('change') + ->where('gedcom_id', '=' , $tree_id) + ->where('status', '=' , 'pending') + ->orderBy('change_id') + ->select(['xref', 'new_gedcom']) + ->get(); foreach ($rows as $row) { self::$pending_record_cache[$tree_id][$row->xref] = $row->new_gedcom; @@ -245,38 +246,35 @@ class GedcomRecord { // We don't know what type of object this is. Try each one in turn. $data = Individual::fetchGedcomRecord($xref, $tree_id); - if ($data) { + if ($data !== null) { return $data; } $data = Family::fetchGedcomRecord($xref, $tree_id); - if ($data) { + if ($data !== null) { return $data; } $data = Source::fetchGedcomRecord($xref, $tree_id); - if ($data) { + if ($data !== null) { return $data; } $data = Repository::fetchGedcomRecord($xref, $tree_id); - if ($data) { + if ($data !== null) { return $data; } $data = Media::fetchGedcomRecord($xref, $tree_id); - if ($data) { + if ($data !== null) { return $data; } $data = Note::fetchGedcomRecord($xref, $tree_id); - if ($data) { + if ($data !== null) { return $data; } // Some other type of record... - - return Database::prepare( - "SELECT o_gedcom FROM `##other` WHERE o_id = :xref AND o_file = :tree_id" - )->execute([ - 'xref' => $xref, - 'tree_id' => $tree_id, - ])->fetchOne(); + return DB::table('o_gedcom') + ->where('o_file', '=', $tree_id) + ->where('o_id', '=', $xref) + ->value('o_gedcom'); } /** |
