1 | <?php |
||
27 | abstract class AbstractQueryProvider extends BaseObject |
||
28 | { |
||
29 | /** |
||
30 | * Initial request params, that contains all the parameters in filter/query part |
||
31 | * @var mixed[] |
||
32 | */ |
||
33 | protected $requestParams = []; |
||
34 | |||
35 | /** |
||
36 | * Query instance |
||
37 | * @var Query |
||
38 | */ |
||
39 | protected $query; |
||
40 | |||
41 | /** |
||
42 | * QueryBuilder instance to handle yii default syntax eg ['not' => ['id' => 'test']] |
||
43 | * @var QueryBuilder |
||
44 | */ |
||
45 | private $queryBuilder; |
||
46 | |||
47 | /** |
||
48 | * This service locator holds all attribute handlers |
||
49 | * @var ServiceLocator |
||
50 | */ |
||
51 | protected $locator; |
||
52 | |||
53 | /** |
||
54 | * Class instance for formatting results after successful request to elasticsearch |
||
55 | * @var string |
||
56 | */ |
||
57 | public $resultsFormatter; |
||
58 | |||
59 | /** |
||
60 | * Return the searchable data model |
||
61 | * |
||
62 | * @return ActiveRecord |
||
63 | */ |
||
64 | abstract public function getModel(); |
||
65 | |||
66 | /** |
||
67 | * Returns query handlers for special cases |
||
68 | * @return array |
||
69 | */ |
||
70 | abstract public function attributeHandlers(); |
||
71 | |||
72 | /** |
||
73 | * @param array $requestParams |
||
74 | * @param array $config |
||
75 | */ |
||
76 | public function __construct($requestParams = [], $config = []) |
||
96 | /** |
||
97 | * This method is used to add conditions to query |
||
98 | * |
||
99 | * @param string $attribute |
||
100 | * @param string|array $value |
||
101 | * @return $this |
||
102 | */ |
||
103 | public function setAttribute($attribute, $value) |
||
122 | |||
123 | /** |
||
124 | * Avoids sending junk to search server |
||
125 | * @param $attribute |
||
126 | * @return bool |
||
127 | * @throws \yii\base\InvalidConfigException |
||
128 | */ |
||
129 | protected function isValidAttribute($attribute) |
||
133 | |||
134 | /** |
||
135 | * Mass sets attributes to query |
||
136 | */ |
||
137 | protected function setAttributes() |
||
148 | |||
149 | /** |
||
150 | * @param bool $multiSearch |
||
151 | * @return ActiveQuery|array |
||
152 | */ |
||
153 | public function getQuery($multiSearch = true) |
||
178 | |||
179 | /** |
||
180 | * Returns base query |
||
181 | * @return ActiveQuery |
||
182 | */ |
||
183 | private function getBaseQuery() |
||
202 | |||
203 | /** |
||
204 | * @param array $aggregations |
||
205 | * @return AbstractQueryProvider |
||
206 | */ |
||
207 | public function setAggregations($aggregations) |
||
212 | |||
213 | /** |
||
214 | * @param array $config |
||
215 | * @throws \yii\base\InvalidConfigException |
||
216 | * @return ResultsFormatterInterface |
||
217 | */ |
||
218 | public function getResultsFormatter($config = []) |
||
226 | |||
227 | /** |
||
228 | * Returns user search keywords |
||
229 | * @return array |
||
230 | */ |
||
231 | public function getSearchKeywords() |
||
235 | |||
236 | /** |
||
237 | * @return Query |
||
238 | */ |
||
239 | public function getQueryInstance() |
||
246 | } |
||
247 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..