1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
/* |
5
|
|
|
* This file is part of the TYPO3 CMS project. |
6
|
|
|
* |
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
9
|
|
|
* of the License, or any later version. |
10
|
|
|
* |
11
|
|
|
* For the full copyright and license information, please read the |
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
13
|
|
|
* |
14
|
|
|
* The TYPO3 project - inspiring people to share! |
15
|
|
|
*/ |
16
|
|
|
|
17
|
|
|
namespace ApacheSolrForTypo3\Solr\Event\Search; |
18
|
|
|
|
19
|
|
|
use ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\SearchResultSet; |
20
|
|
|
use ApacheSolrForTypo3\Solr\Pagination\ResultsPagination; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* This event is triggered before adding the search result to the fluid template |
24
|
|
|
* |
25
|
|
|
* @author Lars Tode <[email protected]> |
26
|
|
|
*/ |
27
|
|
|
final class AfterSearchEvent |
28
|
|
|
{ |
29
|
|
|
private SearchResultSet $resultSet; |
30
|
|
|
private array $additionalFilters; |
31
|
|
|
private string $pluginNamespace; |
32
|
|
|
private array $arguments; |
33
|
|
|
private ResultsPagination $pagination; |
34
|
|
|
private int $currentPage; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @param SearchResultSet $resultSet |
38
|
|
|
* @param array $additionalFilters |
39
|
|
|
* @param string $pluginNamespace |
40
|
|
|
* @param array $arguments |
41
|
|
|
* @param ResultsPagination $pagination |
42
|
|
|
* @param int $currentPage |
43
|
|
|
*/ |
44
|
|
|
public function __construct( |
45
|
|
|
SearchResultSet $resultSet, |
46
|
|
|
array $additionalFilters, |
47
|
|
|
string $pluginNamespace, |
48
|
|
|
array $arguments, |
49
|
|
|
ResultsPagination $pagination, |
50
|
|
|
int $currentPage |
51
|
|
|
) { |
52
|
|
|
$this->resultSet = $resultSet; |
53
|
|
|
$this->additionalFilters = $additionalFilters; |
54
|
|
|
$this->pluginNamespace = $pluginNamespace; |
55
|
|
|
$this->arguments = $arguments; |
56
|
|
|
$this->pagination = $pagination; |
57
|
|
|
$this->currentPage = $currentPage; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @return SearchResultSet |
62
|
|
|
*/ |
63
|
|
|
public function getResultSet(): SearchResultSet |
64
|
|
|
{ |
65
|
|
|
return $this->resultSet; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return array |
70
|
|
|
*/ |
71
|
|
|
public function getAdditionalFilters(): array |
72
|
|
|
{ |
73
|
|
|
return $this->additionalFilters; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
public function getPluginNamespace(): string |
80
|
|
|
{ |
81
|
|
|
return $this->pluginNamespace; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return array |
86
|
|
|
*/ |
87
|
|
|
public function getArguments(): array |
88
|
|
|
{ |
89
|
|
|
return $this->arguments; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return ResultsPagination |
94
|
|
|
*/ |
95
|
|
|
public function getPagination(): ResultsPagination |
96
|
|
|
{ |
97
|
|
|
return $this->pagination; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return int |
102
|
|
|
*/ |
103
|
|
|
public function getCurrentPage(): int |
104
|
|
|
{ |
105
|
|
|
return $this->currentPage; |
106
|
|
|
} |
107
|
|
|
} |
108
|
|
|
|