summaryrefslogtreecommitdiff
path: root/app/Statistics/Repository/FamilyDatesRepository.php
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2023-06-27 22:06:17 +0100
committerGreg Roach <greg@subaqua.co.uk>2023-06-27 22:14:11 +0100
commit2cd72788e6dec614793bbb2b319ea5a74dff28a7 (patch)
tree4c8a5cc9be18133bef1cc9d61011f1e96859a467 /app/Statistics/Repository/FamilyDatesRepository.php
parent1db8f5a0ed4e2f14f98b6e19cc538cbabf6319fe (diff)
downloadwebtrees-2cd72788e6dec614793bbb2b319ea5a74dff28a7.tar.gz
webtrees-2cd72788e6dec614793bbb2b319ea5a74dff28a7.tar.bz2
webtrees-2cd72788e6dec614793bbb2b319ea5a74dff28a7.zip
Fix: events BC break statistics
Diffstat (limited to 'app/Statistics/Repository/FamilyDatesRepository.php')
-rw-r--r--app/Statistics/Repository/FamilyDatesRepository.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/Statistics/Repository/FamilyDatesRepository.php b/app/Statistics/Repository/FamilyDatesRepository.php
index 4c6eb84241..c4691652a4 100644
--- a/app/Statistics/Repository/FamilyDatesRepository.php
+++ b/app/Statistics/Repository/FamilyDatesRepository.php
@@ -67,7 +67,7 @@ class FamilyDatesRepository implements FamilyDatesRepositoryInterface
* @param string $fact
* @param string $operation
*
- * @return object|null
+ * @return object{id:string,year:int,fact:string,type:string}|null
*/
private function eventQuery(string $fact, string $operation): ?object
{
@@ -82,6 +82,14 @@ class FamilyDatesRepository implements FamilyDatesRepositoryInterface
->where('d_fact', '=', $fact)
->where('d_julianday1', '<>', 0);
})
+ ->limit(1)
+ ->get()
+ ->map(static fn (object $row): object => (object) [
+ 'id' => $row->id,
+ 'year' => (int) $row->year,
+ 'fact' => $row->fact,
+ 'type' => $row->type,
+ ])
->first();
}