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
185 public function getMarkMatchingVariants()
186 {
187 if (is_null($this->markMatchingVariants)) {
189 $data = $this->raw(self::FIELD_MARK_MATCHING_VARIANTS);
190 if (is_null($data)) {
191 return null;
192 }
193 $this->markMatchingVariants = (bool) $data;
194 }
195
197 }
198
207 {
208 if (is_null($this->productProjectionParameters)) {
210 $data = $this->raw(self::FIELD_PRODUCT_PROJECTION_PARAMETERS);
211 if (is_null($data)) {
212 return null;
213 }
214
215 $this->productProjectionParameters = ProductSearchProjectionParamsModel::of($data);
216 }
217
219 }
220
227 public function getFacets()
228 {
229 if (is_null($this->facets)) {
231 $data = $this->raw(self::FIELD_FACETS);
232 if (is_null($data)) {
233 return null;
234 }
236 }
237
238 return $this->facets;
239 }
240
248 public function getPostFilter()
249 {
250 if (is_null($this->postFilter)) {
252 $data = $this->raw(self::FIELD_POST_FILTER);
253 if (is_null($data)) {
254 return null;
255 }
256
257 $this->postFilter = SearchQueryModel::of($data);
258 }
259
260 return $this->postFilter;
261 }
262
263
267 public function setQuery(?SearchQuery $query): void
268 {
269 $this->query = $query;
270 }
271
275 public function setSort(?SearchSortingCollection $sort): void
276 {
277 $this->sort = $sort;
278 }
279
283 public function setLimit(?int $limit): void
284 {
285 $this->limit = $limit;
286 }
287
291 public function setOffset(?int $offset): void
292 {
293 $this->offset = $offset;
294 }
295
300 {
301 $this->markMatchingVariants = $markMatchingVariants;
302 }
303
308 {
309 $this->productProjectionParameters = $productProjectionParameters;
310 }
311
316 {
317 $this->facets = $facets;
318 }
319
323 public function setPostFilter(?SearchQuery $postFilter): void
324 {
325 $this->postFilter = $postFilter;
326 }
327}
__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)