commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductSearchRequestModel.php
1<?php
2
3declare(strict_types=1);
10
18use stdClass;
19
24{
29 protected $query;
30
35 protected $sort;
36
41 protected $limit;
42
47 protected $offset;
48
54
60
65 protected $facets;
66
71 protected $postFilter;
72
73
77 public function __construct(
78 ?SearchQuery $query = null,
80 ?int $limit = null,
81 ?int $offset = null,
82 ?bool $markMatchingVariants = null,
86 ) {
87 $this->query = $query;
88 $this->sort = $sort;
89 $this->limit = $limit;
90 $this->offset = $offset;
91 $this->markMatchingVariants = $markMatchingVariants;
92 $this->productProjectionParameters = $productProjectionParameters;
93 $this->facets = $facets;
94 $this->postFilter = $postFilter;
95 }
96
103 public function getQuery()
104 {
105 if (is_null($this->query)) {
107 $data = $this->raw(self::FIELD_QUERY);
108 if (is_null($data)) {
109 return null;
110 }
111
112 $this->query = SearchQueryModel::of($data);
113 }
114
115 return $this->query;
116 }
117
125 public function getSort()
126 {
127 if (is_null($this->sort)) {
129 $data = $this->raw(self::FIELD_SORT);
130 if (is_null($data)) {
131 return null;
132 }
133 $this->sort = SearchSortingCollection::fromArray($data);
134 }
135
136 return $this->sort;
137 }
138
145 public function getLimit()
146 {
147 if (is_null($this->limit)) {
149 $data = $this->raw(self::FIELD_LIMIT);
150 if (is_null($data)) {
151 return null;
152 }
153 $this->limit = (int) $data;
154 }
155
156 return $this->limit;
157 }
158
165 public function getOffset()
166 {
167 if (is_null($this->offset)) {
169 $data = $this->raw(self::FIELD_OFFSET);
170 if (is_null($data)) {
171 return null;
172 }
173 $this->offset = (int) $data;
174 }
175
176 return $this->offset;
177 }
178
187 public function getMarkMatchingVariants()
188 {
189 if (is_null($this->markMatchingVariants)) {
191 $data = $this->raw(self::FIELD_MARK_MATCHING_VARIANTS);
192 if (is_null($data)) {
193 return null;
194 }
195 $this->markMatchingVariants = (bool) $data;
196 }
197
199 }
200
209 {
210 if (is_null($this->productProjectionParameters)) {
212 $data = $this->raw(self::FIELD_PRODUCT_PROJECTION_PARAMETERS);
213 if (is_null($data)) {
214 return null;
215 }
216
217 $this->productProjectionParameters = ProductSearchProjectionParamsModel::of($data);
218 }
219
221 }
222
229 public function getFacets()
230 {
231 if (is_null($this->facets)) {
233 $data = $this->raw(self::FIELD_FACETS);
234 if (is_null($data)) {
235 return null;
236 }
238 }
239
240 return $this->facets;
241 }
242
250 public function getPostFilter()
251 {
252 if (is_null($this->postFilter)) {
254 $data = $this->raw(self::FIELD_POST_FILTER);
255 if (is_null($data)) {
256 return null;
257 }
258
259 $this->postFilter = SearchQueryModel::of($data);
260 }
261
262 return $this->postFilter;
263 }
264
265
269 public function setQuery(?SearchQuery $query): void
270 {
271 $this->query = $query;
272 }
273
277 public function setSort(?SearchSortingCollection $sort): void
278 {
279 $this->sort = $sort;
280 }
281
285 public function setLimit(?int $limit): void
286 {
287 $this->limit = $limit;
288 }
289
293 public function setOffset(?int $offset): void
294 {
295 $this->offset = $offset;
296 }
297
302 {
303 $this->markMatchingVariants = $markMatchingVariants;
304 }
305
310 {
311 $this->productProjectionParameters = $productProjectionParameters;
312 }
313
318 {
319 $this->facets = $facets;
320 }
321
325 public function setPostFilter(?SearchQuery $postFilter): void
326 {
327 $this->postFilter = $postFilter;
328 }
329}
__construct(?SearchQuery $query=null, ?SearchSortingCollection $sort=null, ?int $limit=null, ?int $offset=null, ?bool $markMatchingVariants=null, ?ProductSearchProjectionParams $productProjectionParameters=null, ?ProductSearchFacetExpressionCollection $facets=null, ?SearchQuery $postFilter=null)
setProductProjectionParameters(?ProductSearchProjectionParams $productProjectionParameters)
static fromArray(array $data)