diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2020-05-12 00:38:22 +0100 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2020-05-12 14:19:35 +0100 |
| commit | a091ac74647eab281b25090b737835eeea14ae10 (patch) | |
| tree | 5e968be23c54e70f67812b1cca78c7e1e17aa95d /app/Http/RequestHandlers/DeleteRecord.php | |
| parent | bb03c9f048b83092098d5e46c2ab323ae7e2b314 (diff) | |
| download | webtrees-a091ac74647eab281b25090b737835eeea14ae10.tar.gz webtrees-a091ac74647eab281b25090b737835eeea14ae10.tar.bz2 webtrees-a091ac74647eab281b25090b737835eeea14ae10.zip | |
Update code to use new Factory objects
Diffstat (limited to 'app/Http/RequestHandlers/DeleteRecord.php')
| -rw-r--r-- | app/Http/RequestHandlers/DeleteRecord.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/Http/RequestHandlers/DeleteRecord.php b/app/Http/RequestHandlers/DeleteRecord.php index 0cd339bae5..6df43fe0f7 100644 --- a/app/Http/RequestHandlers/DeleteRecord.php +++ b/app/Http/RequestHandlers/DeleteRecord.php @@ -2,7 +2,7 @@ /** * webtrees: online genealogy - * Copyright (C) 2019 webtrees development team + * Copyright (C) 2020 webtrees development team * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -20,9 +20,9 @@ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\RequestHandlers; use Fisharebest\Webtrees\Auth; +use Fisharebest\Webtrees\Factory; use Fisharebest\Webtrees\FlashMessages; use Fisharebest\Webtrees\Gedcom; -use Fisharebest\Webtrees\GedcomRecord; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Tree; use Psr\Http\Message\ResponseInterface; @@ -56,7 +56,7 @@ class DeleteRecord implements RequestHandlerInterface $xref = $request->getAttribute('xref'); assert(is_string($xref)); - $record = GedcomRecord::getInstance($xref, $tree); + $record = Factory::gedcomRecord()->make($xref, $tree); $record = Auth::checkRecordAccess($record, true); if ($record && Auth::isEditor($record->tree()) && $record->canShow() && $record->canEdit()) { @@ -68,13 +68,13 @@ class DeleteRecord implements RequestHandlerInterface // If we have removed a link from a family to an individual, and it has only one member if (preg_match('/^0 @(' . Gedcom::REGEX_XREF . ')@ FAM/', $new_gedcom, $fmatch) && preg_match_all('/\n1 (HUSB|WIFE|CHIL) @(' . Gedcom::REGEX_XREF . ')@/', $new_gedcom, $match) === 1) { // Delete the family - $family = GedcomRecord::getInstance($fmatch[1], $tree); + $family = Factory::gedcomRecord()->make($fmatch[1], $tree); /* I18N: %s is the name of a family group, e.g. “Husband name + Wife name” */ FlashMessages::addMessage(I18N::translate('The family “%s” has been deleted because it only has one member.', $family->fullName())); $family->deleteRecord(); // Delete any remaining link to this family if ($match) { - $relict = GedcomRecord::getInstance($match[2][0], $tree); + $relict = Factory::gedcomRecord()->make($match[2][0], $tree); $new_gedcom = $relict->gedcom(); $new_gedcom = $this->removeLinks($new_gedcom, $linker->xref()); $relict->updateRecord($new_gedcom, false); |
