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
125 public function getMarkMatchingVariants()
126 {
127 return $this->markMatchingVariants;
128 }
129
138 {
139 return $this->productProjectionParameters instanceof ProductSearchProjectionParamsBuilder ? $this->productProjectionParameters->build() : $this->productProjectionParameters;
140 }
141
148 public function getFacets()
149 {
150 return $this->facets;
151 }
152
160 public function getPostFilter()
161 {
162 return $this->postFilter instanceof SearchQueryBuilder ? $this->postFilter->build() : $this->postFilter;
163 }
164
169 public function withQuery(?SearchQuery $query)
170 {
171 $this->query = $query;
172
173 return $this;
174 }
175
180 public function withSort(?SearchSortingCollection $sort)
181 {
182 $this->sort = $sort;
183
184 return $this;
185 }
186
191 public function withLimit(?int $limit)
192 {
193 $this->limit = $limit;
194
195 return $this;
196 }
197
202 public function withOffset(?int $offset)
203 {
204 $this->offset = $offset;
205
206 return $this;
207 }
208
213 public function withMarkMatchingVariants(?bool $markMatchingVariants)
214 {
215 $this->markMatchingVariants = $markMatchingVariants;
216
217 return $this;
218 }
219
224 public function withProductProjectionParameters(?ProductSearchProjectionParams $productProjectionParameters)
225 {
226 $this->productProjectionParameters = $productProjectionParameters;
227
228 return $this;
229 }
230
236 {
237 $this->facets = $facets;
238
239 return $this;
240 }
241
246 public function withPostFilter(?SearchQuery $postFilter)
247 {
248 $this->postFilter = $postFilter;
249
250 return $this;
251 }
252
257 public function withQueryBuilder(?SearchQueryBuilder $query)
258 {
259 $this->query = $query;
260
261 return $this;
262 }
263
269 {
270 $this->productProjectionParameters = $productProjectionParameters;
271
272 return $this;
273 }
274
279 public function withPostFilterBuilder(?SearchQueryBuilder $postFilter)
280 {
281 $this->postFilter = $postFilter;
282
283 return $this;
284 }
285
286 public function build(): ProductSearchRequest
287 {
288 return new ProductSearchRequestModel(
289 $this->query instanceof SearchQueryBuilder ? $this->query->build() : $this->query,
290 $this->sort,
291 $this->limit,
292 $this->offset,
293 $this->markMatchingVariants,
294 $this->productProjectionParameters instanceof ProductSearchProjectionParamsBuilder ? $this->productProjectionParameters->build() : $this->productProjectionParameters,
295 $this->facets,
296 $this->postFilter instanceof SearchQueryBuilder ? $this->postFilter->build() : $this->postFilter
297 );
298 }
299
300 public static function of(): ProductSearchRequestBuilder
301 {
302 return new self();
303 }
304}
withProductProjectionParametersBuilder(?ProductSearchProjectionParamsBuilder $productProjectionParameters)
withProductProjectionParameters(?ProductSearchProjectionParams $productProjectionParameters)