diff --git a/src/Helpers/AppHelper.php b/src/Helpers/AppHelper.php index 862013f..4743270 100644 --- a/src/Helpers/AppHelper.php +++ b/src/Helpers/AppHelper.php @@ -7,13 +7,20 @@ class AppHelper { + /** + * @param string $class + * @return mixed + * @throws \Psr\Container\ContainerExceptionInterface + * @throws \Psr\Container\NotFoundExceptionInterface + * @throws \Exception + */ public static function get(string $class) { - if (version_compare(Webtrees::VERSION, '2.2.0', '>=')) { + if (version_compare(Webtrees::VERSION, '2.2.0', '>=')) {// @phpstan-ignore-line return \Fisharebest\Webtrees\Registry::container()->get($class); } - if (function_exists('app')) { + if (function_exists('app')) {// @phpstan-ignore-line return app($class); } diff --git a/src/Http/Controllers/AdminController.php b/src/Http/Controllers/AdminController.php index c3d6dea..53a52c5 100644 --- a/src/Http/Controllers/AdminController.php +++ b/src/Http/Controllers/AdminController.php @@ -2,6 +2,7 @@ namespace UksusoFF\WebtreesModules\Faces\Http\Controllers; +use Exception; use Fisharebest\Webtrees\Auth; use Fisharebest\Webtrees\Http\Exceptions\HttpAccessDeniedException; use Fisharebest\Webtrees\Http\Exceptions\HttpNotFoundException; @@ -152,9 +153,14 @@ private function prepareRow($row): array return $item['pid']; }, json_decode($row->f_coordinates, true))); + try { + $tree = $this->trees->find((int) $row->m_file); + } catch (Exception $e) { + return $this->rowMissed($row, $pids); + } + if ( $row->m_file === null || - ($tree = $this->trees->find((int) $row->m_file)) === null || ($media = Registry::mediaFactory()->make($row->f_m_id, $tree)) === null || ($file = $this->module->media->getMediaImageFileByOrder($media, (int) $row->f_m_order)) === null ) { diff --git a/src/Http/Controllers/DataController.php b/src/Http/Controllers/DataController.php index 4485f81..6299aa3 100644 --- a/src/Http/Controllers/DataController.php +++ b/src/Http/Controllers/DataController.php @@ -191,7 +191,7 @@ private function getMediaMapForTree(Media $media, string $fact): array } if (!empty($result)) { - foreach ($this->module->query->getIndividualsDataByTreeAndPids($media->tree()->id(), $pids) as $row) { + foreach ($this->module->query->getIndividualsDataByTreeAndPids((string) $media->tree()->id(), $pids) as $row) { $person = Registry::individualFactory()->make($row->xref, $media->tree(), $row->gedcom); if ($person === null) { continue; diff --git a/src/Modules/FacesModule.php b/src/Modules/FacesModule.php index 2a51e23..cb7e9f6 100644 --- a/src/Modules/FacesModule.php +++ b/src/Modules/FacesModule.php @@ -36,7 +36,7 @@ class FacesModule extends AbstractModule implements ModuleCustomInterface, Modul use ModuleConfigTrait; use ModuleTabTrait; - public const SCHEMA_VERSION = '7'; + public const SCHEMA_VERSION = 7; public const CUSTOM_VERSION = '2.7.3';