From 70cb0d463f7d39e8fe03fafeb8e50693c2bd1887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hrvoje=20Kne=C5=BEevi=C4=87?= Date: Mon, 19 Oct 2020 16:55:40 +0200 Subject: [PATCH] [FIX] always initialize suggestion property with an empty object, and make sure that the ExtraSearchResult suggestion property actually contains Suggestion object --- lib/Core/Pagination/Pagerfanta/BaseAdapter.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Core/Pagination/Pagerfanta/BaseAdapter.php b/lib/Core/Pagination/Pagerfanta/BaseAdapter.php index 5665f0db..5e324479 100644 --- a/lib/Core/Pagination/Pagerfanta/BaseAdapter.php +++ b/lib/Core/Pagination/Pagerfanta/BaseAdapter.php @@ -135,7 +135,11 @@ private function setExtraInfo(SearchResult $searchResult) $this->facets = $searchResult->facets; $this->maxScore = $searchResult->maxScore; $this->nbResults = $searchResult->totalCount; - $this->suggestion = $searchResult instanceof ExtraSearchResult ? $searchResult->suggestion : new Suggestion([]); + $this->suggestion = new Suggestion([]); + + if ($searchResult instanceof ExtraSearchResult && $searchResult->suggestion instanceof Suggestion) { + $this->suggestion = $searchResult->suggestion; + } $this->isExtraInfoInitialized = true; }