commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductSearchRequestBuilder.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
25{
30 private $query;
31
36 private $sort;
37
42 private $limit;
43
48 private $offset;
49
54 private $markMatchingVariants;
55
60 private $productProjectionParameters;
61
66 private $facets;
67
72 private $postFilter;
73
80 public function getQuery()
81 {
82 return $this->query instanceof SearchQueryBuilder ? $this->query->build() : $this->query;
83 }
84
92 public function getSort()
93 {
94 return $this->sort;
95 }
96
103 public function getLimit()
104 {
105 return $this->limit;
106 }
107
114 public function getOffset()
115 {
116 return $this->offset;
117 }
118
127 public function getMarkMatchingVariants()
128 {
129 return $this->markMatchingVariants;
130 }
131
140 {
141 return $this->productProjectionParameters instanceof ProductSearchProjectionParamsBuilder ? $this->productProjectionParameters->build() : $this->productProjectionParameters;
142 }
143
150 public function getFacets()
151 {
152 return $this->facets;
153 }
154
162 public function getPostFilter()
163 {
164 return $this->postFilter instanceof SearchQueryBuilder ? $this->postFilter->build() : $this->postFilter;
165 }
166
171 public function withQuery(?SearchQuery $query)
172 {
173 $this->query = $query;
174
175 return $this;
176 }
177
182 public function withSort(?SearchSortingCollection $sort)
183 {
184 $this->sort = $sort;
185
186 return $this;
187 }
188
193 public function withLimit(?int $limit)
194 {
195 $this->limit = $limit;
196
197 return $this;
198 }
199
204 public function withOffset(?int $offset)
205 {
206 $this->offset = $offset;
207
208 return $this;
209 }
210
215 public function withMarkMatchingVariants(?bool $markMatchingVariants)
216 {
217 $this->markMatchingVariants = $markMatchingVariants;
218
219 return $this;
220 }
221
226 public function withProductProjectionParameters(?ProductSearchProjectionParams $productProjectionParameters)
227 {
228 $this->productProjectionParameters = $productProjectionParameters;
229
230 return $this;
231 }
232
238 {
239 $this->facets = $facets;
240
241 return $this;
242 }
243
248 public function withPostFilter(?SearchQuery $postFilter)
249 {
250 $this->postFilter = $postFilter;
251
252 return $this;
253 }
254
259 public function withQueryBuilder(?SearchQueryBuilder $query)
260 {
261 $this->query = $query;
262
263 return $this;
264 }
265
271 {
272 $this->productProjectionParameters = $productProjectionParameters;
273
274 return $this;
275 }
276
281 public function withPostFilterBuilder(?SearchQueryBuilder $postFilter)
282 {
283 $this->postFilter = $postFilter;
284
285 return $this;
286 }
287
288 public function build(): ProductSearchRequest
289 {
290 return new ProductSearchRequestModel(
291 $this->query instanceof SearchQueryBuilder ? $this->query->build() : $this->query,
292 $this->sort,
293 $this->limit,
294 $this->offset,
295 $this->markMatchingVariants,
296 $this->productProjectionParameters instanceof ProductSearchProjectionParamsBuilder ? $this->productProjectionParameters->build() : $this->productProjectionParameters,
297 $this->facets,
298 $this->postFilter instanceof SearchQueryBuilder ? $this->postFilter->build() : $this->postFilter
299 );
300 }
301
302 public static function of(): ProductSearchRequestBuilder
303 {
304 return new self();
305 }
306}
withProductProjectionParametersBuilder(?ProductSearchProjectionParamsBuilder $productProjectionParameters)
withProductProjectionParameters(?ProductSearchProjectionParams $productProjectionParameters)