commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Search
SearchDateRangeValueModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Search
;
10
11
use
Commercetools\Base\DateTimeImmutableCollection
;
12
use
Commercetools\Base\JsonObject
;
13
use
Commercetools\Base\JsonObjectModel
;
14
use
Commercetools\Base\MapperFactory
;
15
use DateTimeImmutable;
16
use stdClass;
17
21
final
class
SearchDateRangeValueModel
extends
JsonObjectModel
implements
SearchDateRangeValue
22
{
27
protected
$field
;
28
33
protected
$boost
;
34
39
protected
$fieldType
;
40
45
protected
$gte
;
46
51
protected
$gt
;
52
57
protected
$lte
;
58
63
protected
$lt
;
64
65
69
public
function
__construct
(
70
?
string
$field
=
null
,
71
?
float
$boost
=
null
,
72
?
string
$fieldType
=
null
,
73
?DateTimeImmutable
$gte
=
null
,
74
?DateTimeImmutable
$gt
=
null
,
75
?DateTimeImmutable
$lte
=
null
,
76
?DateTimeImmutable
$lt
=
null
77
) {
78
$this->field =
$field
;
79
$this->boost =
$boost
;
80
$this->fieldType =
$fieldType
;
81
$this->gte =
$gte
;
82
$this->gt =
$gt
;
83
$this->lte =
$lte
;
84
$this->lt =
$lt
;
85
}
86
91
public
function
getField
()
92
{
93
if
(is_null($this->field)) {
95
$data = $this->
raw
(self::FIELD_FIELD);
96
if
(is_null($data)) {
97
return
null
;
98
}
99
$this->field = (string) $data;
100
}
101
102
return
$this->field
;
103
}
104
109
public
function
getBoost
()
110
{
111
if
(is_null($this->boost)) {
113
$data = $this->
raw
(self::FIELD_BOOST);
114
if
(is_null($data)) {
115
return
null
;
116
}
117
$this->boost = (float) $data;
118
}
119
120
return
$this->boost
;
121
}
122
129
public
function
getFieldType
()
130
{
131
if
(is_null($this->fieldType)) {
133
$data = $this->
raw
(self::FIELD_FIELD_TYPE);
134
if
(is_null($data)) {
135
return
null
;
136
}
137
$this->fieldType = (string) $data;
138
}
139
140
return
$this->fieldType
;
141
}
142
147
public
function
getGte
()
148
{
149
if
(is_null($this->gte)) {
151
$data = $this->
raw
(self::FIELD_GTE);
152
if
(is_null($data)) {
153
return
null
;
154
}
155
$data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
156
if
(
false
=== $data) {
157
return
null
;
158
}
159
$this->gte = $data;
160
}
161
162
return
$this->gte
;
163
}
164
169
public
function
getGt
()
170
{
171
if
(is_null($this->gt)) {
173
$data = $this->
raw
(self::FIELD_GT);
174
if
(is_null($data)) {
175
return
null
;
176
}
177
$data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
178
if
(
false
=== $data) {
179
return
null
;
180
}
181
$this->gt = $data;
182
}
183
184
return
$this->gt
;
185
}
186
191
public
function
getLte
()
192
{
193
if
(is_null($this->lte)) {
195
$data = $this->
raw
(self::FIELD_LTE);
196
if
(is_null($data)) {
197
return
null
;
198
}
199
$data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
200
if
(
false
=== $data) {
201
return
null
;
202
}
203
$this->lte = $data;
204
}
205
206
return
$this->lte
;
207
}
208
213
public
function
getLt
()
214
{
215
if
(is_null($this->lt)) {
217
$data = $this->
raw
(self::FIELD_LT);
218
if
(is_null($data)) {
219
return
null
;
220
}
221
$data = DateTimeImmutable::createFromFormat(MapperFactory::DATE_FORMAT, $data);
222
if
(
false
=== $data) {
223
return
null
;
224
}
225
$this->lt = $data;
226
}
227
228
return
$this->lt
;
229
}
230
231
235
public
function
setField
(?
string
$field
): void
236
{
237
$this->field =
$field
;
238
}
239
243
public
function
setBoost
(?
float
$boost
): void
244
{
245
$this->boost =
$boost
;
246
}
247
251
public
function
setFieldType
(?
string
$fieldType
): void
252
{
253
$this->fieldType =
$fieldType
;
254
}
255
259
public
function
setGte
(?DateTimeImmutable
$gte
): void
260
{
261
$this->gte =
$gte
;
262
}
263
267
public
function
setGt
(?DateTimeImmutable
$gt
): void
268
{
269
$this->gt =
$gt
;
270
}
271
275
public
function
setLte
(?DateTimeImmutable
$lte
): void
276
{
277
$this->lte =
$lte
;
278
}
279
283
public
function
setLt
(?DateTimeImmutable
$lt
): void
284
{
285
$this->lt =
$lt
;
286
}
287
288
289
#[\ReturnTypeWillChange]
290
public
function
jsonSerialize
()
291
{
292
$data = $this->
toArray
();
293
if
(isset($data[
SearchDateRangeValue::FIELD_GTE
]) && $data[
SearchDateRangeValue::FIELD_GTE
] instanceof \DateTimeImmutable) {
294
$data[
SearchDateRangeValue::FIELD_GTE
] = $data[
SearchDateRangeValue::FIELD_GTE
]->format(
'Y-m-d'
);
295
}
296
297
if
(isset($data[
SearchDateRangeValue::FIELD_GT
]) && $data[
SearchDateRangeValue::FIELD_GT
] instanceof \DateTimeImmutable) {
298
$data[
SearchDateRangeValue::FIELD_GT
] = $data[
SearchDateRangeValue::FIELD_GT
]->format(
'Y-m-d'
);
299
}
300
301
if
(isset($data[
SearchDateRangeValue::FIELD_LTE
]) && $data[
SearchDateRangeValue::FIELD_LTE
] instanceof \DateTimeImmutable) {
302
$data[
SearchDateRangeValue::FIELD_LTE
] = $data[
SearchDateRangeValue::FIELD_LTE
]->format(
'Y-m-d'
);
303
}
304
305
if
(isset($data[
SearchDateRangeValue::FIELD_LT
]) && $data[
SearchDateRangeValue::FIELD_LT
] instanceof \DateTimeImmutable) {
306
$data[
SearchDateRangeValue::FIELD_LT
] = $data[
SearchDateRangeValue::FIELD_LT
]->format(
'Y-m-d'
);
307
}
308
return
(
object
) $data;
309
}
310
}
Commercetools\Api\Models\Search\SearchDateRangeValueModel
Definition
SearchDateRangeValueModel.php:22
Commercetools\Api\Models\Search\SearchDateRangeValueModel\setFieldType
setFieldType(?string $fieldType)
Definition
SearchDateRangeValueModel.php:251
Commercetools\Api\Models\Search\SearchDateRangeValueModel\$fieldType
$fieldType
Definition
SearchDateRangeValueModel.php:39
Commercetools\Api\Models\Search\SearchDateRangeValueModel\getFieldType
getFieldType()
Definition
SearchDateRangeValueModel.php:129
Commercetools\Api\Models\Search\SearchDateRangeValueModel\$field
$field
Definition
SearchDateRangeValueModel.php:27
Commercetools\Api\Models\Search\SearchDateRangeValueModel\$lte
$lte
Definition
SearchDateRangeValueModel.php:57
Commercetools\Api\Models\Search\SearchDateRangeValueModel\setField
setField(?string $field)
Definition
SearchDateRangeValueModel.php:235
Commercetools\Api\Models\Search\SearchDateRangeValueModel\setLt
setLt(?DateTimeImmutable $lt)
Definition
SearchDateRangeValueModel.php:283
Commercetools\Api\Models\Search\SearchDateRangeValueModel\$gte
$gte
Definition
SearchDateRangeValueModel.php:45
Commercetools\Api\Models\Search\SearchDateRangeValueModel\getGte
getGte()
Definition
SearchDateRangeValueModel.php:147
Commercetools\Api\Models\Search\SearchDateRangeValueModel\$lt
$lt
Definition
SearchDateRangeValueModel.php:63
Commercetools\Api\Models\Search\SearchDateRangeValueModel\jsonSerialize
jsonSerialize()
Definition
SearchDateRangeValueModel.php:290
Commercetools\Api\Models\Search\SearchDateRangeValueModel\getField
getField()
Definition
SearchDateRangeValueModel.php:91
Commercetools\Api\Models\Search\SearchDateRangeValueModel\setLte
setLte(?DateTimeImmutable $lte)
Definition
SearchDateRangeValueModel.php:275
Commercetools\Api\Models\Search\SearchDateRangeValueModel\getLte
getLte()
Definition
SearchDateRangeValueModel.php:191
Commercetools\Api\Models\Search\SearchDateRangeValueModel\getGt
getGt()
Definition
SearchDateRangeValueModel.php:169
Commercetools\Api\Models\Search\SearchDateRangeValueModel\setBoost
setBoost(?float $boost)
Definition
SearchDateRangeValueModel.php:243
Commercetools\Api\Models\Search\SearchDateRangeValueModel\getLt
getLt()
Definition
SearchDateRangeValueModel.php:213
Commercetools\Api\Models\Search\SearchDateRangeValueModel\setGte
setGte(?DateTimeImmutable $gte)
Definition
SearchDateRangeValueModel.php:259
Commercetools\Api\Models\Search\SearchDateRangeValueModel\getBoost
getBoost()
Definition
SearchDateRangeValueModel.php:109
Commercetools\Api\Models\Search\SearchDateRangeValueModel\setGt
setGt(?DateTimeImmutable $gt)
Definition
SearchDateRangeValueModel.php:267
Commercetools\Api\Models\Search\SearchDateRangeValueModel\$boost
$boost
Definition
SearchDateRangeValueModel.php:33
Commercetools\Api\Models\Search\SearchDateRangeValueModel\__construct
__construct(?string $field=null, ?float $boost=null, ?string $fieldType=null, ?DateTimeImmutable $gte=null, ?DateTimeImmutable $gt=null, ?DateTimeImmutable $lte=null, ?DateTimeImmutable $lt=null)
Definition
SearchDateRangeValueModel.php:69
Commercetools\Api\Models\Search\SearchDateRangeValueModel\$gt
$gt
Definition
SearchDateRangeValueModel.php:51
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\JsonObjectModel\toArray
toArray()
Definition
JsonObjectModel.php:32
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Search\SearchDateRangeValue
Definition
SearchDateRangeValue.php:16
Commercetools\Api\Models\Search\SearchDateRangeValue\FIELD_LT
const FIELD_LT
Definition
SearchDateRangeValue.php:20
Commercetools\Api\Models\Search\SearchDateRangeValue\FIELD_LTE
const FIELD_LTE
Definition
SearchDateRangeValue.php:19
Commercetools\Api\Models\Search\SearchDateRangeValue\FIELD_GTE
const FIELD_GTE
Definition
SearchDateRangeValue.php:17
Commercetools\Api\Models\Search\SearchDateRangeValue\FIELD_GT
const FIELD_GT
Definition
SearchDateRangeValue.php:18
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Search
Definition
SearchAndExpression.php:9
Generated by
1.9.8