1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the slince/shopify-api-php |
5
|
|
|
* |
6
|
|
|
* (c) Slince <[email protected]> |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Slince\Shopify\Manager\PriceRule; |
13
|
|
|
|
14
|
|
|
use Slince\Shopify\Common\Model\Model; |
15
|
|
|
use Slince\Shopify\Common\Model\AdminGraphqlApiId; |
16
|
|
|
|
17
|
|
|
class PriceRule extends Model |
18
|
|
|
{ |
19
|
|
|
use AdminGraphqlApiId; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var string |
23
|
|
|
*/ |
24
|
|
|
protected $allocationMethod; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var \DateTimeInterface |
28
|
|
|
*/ |
29
|
|
|
protected $createdAt; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $customerSelection; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var \DateTimeInterface |
38
|
|
|
*/ |
39
|
|
|
protected $endsAt; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var array |
43
|
|
|
*/ |
44
|
|
|
protected $entitledCollectionIds; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var array |
48
|
|
|
*/ |
49
|
|
|
protected $entitledCountryIds; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var array |
53
|
|
|
*/ |
54
|
|
|
protected $entitledProductIds; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var array |
58
|
|
|
*/ |
59
|
|
|
protected $entitledVariantIds; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
protected $oncePerCustomer; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var array |
68
|
|
|
*/ |
69
|
|
|
protected $prerequisiteCustomerIds; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var array |
73
|
|
|
*/ |
74
|
|
|
protected $prerequisiteQuantityRange; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var array |
78
|
|
|
*/ |
79
|
|
|
protected $prerequisiteSavedSearchIds; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var array |
83
|
|
|
*/ |
84
|
|
|
protected $prerequisiteShippingPriceRange; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var array |
88
|
|
|
*/ |
89
|
|
|
protected $prerequisiteSubtotalRange; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var string |
93
|
|
|
*/ |
94
|
|
|
protected $startsAt; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @var string |
98
|
|
|
*/ |
99
|
|
|
protected $targetSelection; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @var string |
103
|
|
|
*/ |
104
|
|
|
protected $targetType; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @var string |
108
|
|
|
*/ |
109
|
|
|
protected $title; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @var string |
113
|
|
|
*/ |
114
|
|
|
protected $usageLimit; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @var array |
118
|
|
|
*/ |
119
|
|
|
protected $prerequisiteProductIds; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @var array |
123
|
|
|
*/ |
124
|
|
|
protected $prerequisiteVariantIds; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @var array |
128
|
|
|
*/ |
129
|
|
|
protected $prerequisiteCollectionIds; |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @var int |
133
|
|
|
*/ |
134
|
|
|
protected $value; |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @var string |
138
|
|
|
*/ |
139
|
|
|
protected $valueType; |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @var array |
143
|
|
|
*/ |
144
|
|
|
protected $prerequisiteToEntitlementQuantityRatio; |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
|
|
public function getAllocationMethod() |
150
|
|
|
{ |
151
|
|
|
return $this->allocationMethod; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @param string $allocationMethod |
156
|
|
|
* |
157
|
|
|
* @return PriceRule |
158
|
|
|
*/ |
159
|
|
|
public function setAllocationMethod($allocationMethod) |
160
|
|
|
{ |
161
|
|
|
$this->allocationMethod = $allocationMethod; |
162
|
|
|
|
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @return \DateTimeInterface |
168
|
|
|
*/ |
169
|
|
|
public function getCreatedAt() |
170
|
|
|
{ |
171
|
|
|
return $this->createdAt; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @param \DateTimeInterface $createdAt |
176
|
|
|
* |
177
|
|
|
* @return PriceRule |
178
|
|
|
*/ |
179
|
|
|
public function setCreatedAt($createdAt) |
180
|
|
|
{ |
181
|
|
|
$this->createdAt = $createdAt; |
182
|
|
|
|
183
|
|
|
return $this; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
/** |
187
|
|
|
* @return string |
188
|
|
|
*/ |
189
|
|
|
public function getCustomerSelection() |
190
|
|
|
{ |
191
|
|
|
return $this->customerSelection; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @param string $customerSelection |
196
|
|
|
* |
197
|
|
|
* @return PriceRule |
198
|
|
|
*/ |
199
|
|
|
public function setCustomerSelection($customerSelection) |
200
|
|
|
{ |
201
|
|
|
$this->customerSelection = $customerSelection; |
202
|
|
|
|
203
|
|
|
return $this; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @return \DateTimeInterface |
208
|
|
|
*/ |
209
|
|
|
public function getEndsAt() |
210
|
|
|
{ |
211
|
|
|
return $this->endsAt; |
212
|
|
|
} |
213
|
|
|
|
214
|
|
|
/** |
215
|
|
|
* @param \DateTimeInterface $endsAt |
216
|
|
|
* |
217
|
|
|
* @return PriceRule |
218
|
|
|
*/ |
219
|
|
|
public function setEndsAt($endsAt) |
220
|
|
|
{ |
221
|
|
|
$this->endsAt = $endsAt; |
222
|
|
|
|
223
|
|
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* @return array |
228
|
|
|
*/ |
229
|
|
|
public function getEntitledCollectionIds() |
230
|
|
|
{ |
231
|
|
|
return $this->entitledCollectionIds; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* @param array $entitledCollectionIds |
236
|
|
|
* |
237
|
|
|
* @return PriceRule |
238
|
|
|
*/ |
239
|
|
|
public function setEntitledCollectionIds($entitledCollectionIds) |
240
|
|
|
{ |
241
|
|
|
$this->entitledCollectionIds = $entitledCollectionIds; |
242
|
|
|
|
243
|
|
|
return $this; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
/** |
247
|
|
|
* @return array |
248
|
|
|
*/ |
249
|
|
|
public function getEntitledCountryIds() |
250
|
|
|
{ |
251
|
|
|
return $this->entitledCountryIds; |
252
|
|
|
} |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* @param array $entitledCountryIds |
256
|
|
|
* |
257
|
|
|
* @return PriceRule |
258
|
|
|
*/ |
259
|
|
|
public function setEntitledCountryIds($entitledCountryIds) |
260
|
|
|
{ |
261
|
|
|
$this->entitledCountryIds = $entitledCountryIds; |
262
|
|
|
|
263
|
|
|
return $this; |
264
|
|
|
} |
265
|
|
|
|
266
|
|
|
/** |
267
|
|
|
* @return array |
268
|
|
|
*/ |
269
|
|
|
public function getEntitledProductIds() |
270
|
|
|
{ |
271
|
|
|
return $this->entitledProductIds; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* @param array $entitledProductIds |
276
|
|
|
* |
277
|
|
|
* @return PriceRule |
278
|
|
|
*/ |
279
|
|
|
public function setEntitledProductIds($entitledProductIds) |
280
|
|
|
{ |
281
|
|
|
$this->entitledProductIds = $entitledProductIds; |
282
|
|
|
|
283
|
|
|
return $this; |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* @return array |
288
|
|
|
*/ |
289
|
|
|
public function getEntitledVariantIds() |
290
|
|
|
{ |
291
|
|
|
return $this->entitledVariantIds; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* @param array $entitledVariantIds |
296
|
|
|
* |
297
|
|
|
* @return PriceRule |
298
|
|
|
*/ |
299
|
|
|
public function setEntitledVariantIds($entitledVariantIds) |
300
|
|
|
{ |
301
|
|
|
$this->entitledVariantIds = $entitledVariantIds; |
302
|
|
|
|
303
|
|
|
return $this; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* @return string |
308
|
|
|
*/ |
309
|
|
|
public function getOncePerCustomer() |
310
|
|
|
{ |
311
|
|
|
return $this->oncePerCustomer; |
312
|
|
|
} |
313
|
|
|
|
314
|
|
|
/** |
315
|
|
|
* @param boolean $oncePerCustomer |
316
|
|
|
* |
317
|
|
|
* @return PriceRule |
318
|
|
|
*/ |
319
|
|
|
public function setOncePerCustomer($oncePerCustomer) |
320
|
|
|
{ |
321
|
|
|
$this->oncePerCustomer = $oncePerCustomer; |
|
|
|
|
322
|
|
|
|
323
|
|
|
return $this; |
324
|
|
|
} |
325
|
|
|
|
326
|
|
|
/** |
327
|
|
|
* @return array |
328
|
|
|
*/ |
329
|
|
|
public function getPrerequisiteCustomerIds() |
330
|
|
|
{ |
331
|
|
|
return $this->prerequisiteCustomerIds; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
/** |
335
|
|
|
* @param array $prerequisiteCustomerIds |
336
|
|
|
* |
337
|
|
|
* @return PriceRule |
338
|
|
|
*/ |
339
|
|
|
public function setPrerequisiteCustomerIds($prerequisiteCustomerIds) |
340
|
|
|
{ |
341
|
|
|
$this->prerequisiteCustomerIds = $prerequisiteCustomerIds; |
342
|
|
|
|
343
|
|
|
return $this; |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* @return array |
348
|
|
|
*/ |
349
|
|
|
public function getPrerequisiteQuantityRange() |
350
|
|
|
{ |
351
|
|
|
return $this->prerequisiteQuantityRange; |
352
|
|
|
} |
353
|
|
|
|
354
|
|
|
/** |
355
|
|
|
* @param array $prerequisiteQuantityRange |
356
|
|
|
* |
357
|
|
|
* @return PriceRule |
358
|
|
|
*/ |
359
|
|
|
public function setPrerequisiteQuantityRange($prerequisiteQuantityRange) |
360
|
|
|
{ |
361
|
|
|
$this->prerequisiteQuantityRange = $prerequisiteQuantityRange; |
362
|
|
|
|
363
|
|
|
return $this; |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
/** |
367
|
|
|
* @return array |
368
|
|
|
*/ |
369
|
|
|
public function getPrerequisiteSavedSearchIds() |
370
|
|
|
{ |
371
|
|
|
return $this->prerequisiteSavedSearchIds; |
372
|
|
|
} |
373
|
|
|
|
374
|
|
|
/** |
375
|
|
|
* @param array $prerequisiteSavedSearchIds |
376
|
|
|
* |
377
|
|
|
* @return PriceRule |
378
|
|
|
*/ |
379
|
|
|
public function setPrerequisiteSavedSearchIds($prerequisiteSavedSearchIds) |
380
|
|
|
{ |
381
|
|
|
$this->prerequisiteSavedSearchIds = $prerequisiteSavedSearchIds; |
382
|
|
|
|
383
|
|
|
return $this; |
384
|
|
|
} |
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* @return array |
388
|
|
|
*/ |
389
|
|
|
public function getPrerequisiteShippingPriceRange() |
390
|
|
|
{ |
391
|
|
|
return $this->prerequisiteShippingPriceRange; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
/** |
395
|
|
|
* @param array $prerequisiteShippingPriceRange |
396
|
|
|
* |
397
|
|
|
* @return PriceRule |
398
|
|
|
*/ |
399
|
|
|
public function setPrerequisiteShippingPriceRange($prerequisiteShippingPriceRange) |
400
|
|
|
{ |
401
|
|
|
$this->prerequisiteShippingPriceRange = $prerequisiteShippingPriceRange; |
402
|
|
|
|
403
|
|
|
return $this; |
404
|
|
|
} |
405
|
|
|
|
406
|
|
|
/** |
407
|
|
|
* @return array |
408
|
|
|
*/ |
409
|
|
|
public function getPrerequisiteSubtotalRange() |
410
|
|
|
{ |
411
|
|
|
return $this->prerequisiteSubtotalRange; |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* @param array $prerequisiteSubtotalRange |
416
|
|
|
* |
417
|
|
|
* @return PriceRule |
418
|
|
|
*/ |
419
|
|
|
public function setPrerequisiteSubtotalRange($prerequisiteSubtotalRange) |
420
|
|
|
{ |
421
|
|
|
$this->prerequisiteSubtotalRange = $prerequisiteSubtotalRange; |
422
|
|
|
|
423
|
|
|
return $this; |
424
|
|
|
} |
425
|
|
|
|
426
|
|
|
/** |
427
|
|
|
* @return string |
428
|
|
|
*/ |
429
|
|
|
public function getStartsAt() |
430
|
|
|
{ |
431
|
|
|
return $this->startsAt; |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
/** |
435
|
|
|
* @param string $startsAt |
436
|
|
|
* |
437
|
|
|
* @return PriceRule |
438
|
|
|
*/ |
439
|
|
|
public function setStartsAt($startsAt) |
440
|
|
|
{ |
441
|
|
|
$this->startsAt = $startsAt; |
442
|
|
|
|
443
|
|
|
return $this; |
444
|
|
|
} |
445
|
|
|
|
446
|
|
|
/** |
447
|
|
|
* @return string |
448
|
|
|
*/ |
449
|
|
|
public function getTargetSelection() |
450
|
|
|
{ |
451
|
|
|
return $this->targetSelection; |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
/** |
455
|
|
|
* @param string $targetSelection |
456
|
|
|
* |
457
|
|
|
* @return PriceRule |
458
|
|
|
*/ |
459
|
|
|
public function setTargetSelection($targetSelection) |
460
|
|
|
{ |
461
|
|
|
$this->targetSelection = $targetSelection; |
462
|
|
|
|
463
|
|
|
return $this; |
464
|
|
|
} |
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* @return string |
468
|
|
|
*/ |
469
|
|
|
public function getTargetType() |
470
|
|
|
{ |
471
|
|
|
return $this->targetType; |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
/** |
475
|
|
|
* @param string $targetType |
476
|
|
|
* |
477
|
|
|
* @return PriceRule |
478
|
|
|
*/ |
479
|
|
|
public function setTargetType($targetType) |
480
|
|
|
{ |
481
|
|
|
$this->targetType = $targetType; |
482
|
|
|
|
483
|
|
|
return $this; |
484
|
|
|
} |
485
|
|
|
|
486
|
|
|
/** |
487
|
|
|
* @return string |
488
|
|
|
*/ |
489
|
|
|
public function getTitle() |
490
|
|
|
{ |
491
|
|
|
return $this->title; |
492
|
|
|
} |
493
|
|
|
|
494
|
|
|
/** |
495
|
|
|
* @param string $title |
496
|
|
|
* |
497
|
|
|
* @return PriceRule |
498
|
|
|
*/ |
499
|
|
|
public function setTitle($title) |
500
|
|
|
{ |
501
|
|
|
$this->title = $title; |
502
|
|
|
|
503
|
|
|
return $this; |
504
|
|
|
} |
505
|
|
|
|
506
|
|
|
/** |
507
|
|
|
* @return string |
508
|
|
|
*/ |
509
|
|
|
public function getUsageLimit() |
510
|
|
|
{ |
511
|
|
|
return $this->usageLimit; |
512
|
|
|
} |
513
|
|
|
|
514
|
|
|
/** |
515
|
|
|
* @param string $usageLimit |
516
|
|
|
* |
517
|
|
|
* @return PriceRule |
518
|
|
|
*/ |
519
|
|
|
public function setUsageLimit($usageLimit) |
520
|
|
|
{ |
521
|
|
|
$this->usageLimit = $usageLimit; |
522
|
|
|
|
523
|
|
|
return $this; |
524
|
|
|
} |
525
|
|
|
|
526
|
|
|
/** |
527
|
|
|
* @return array |
528
|
|
|
*/ |
529
|
|
|
public function getPrerequisiteProductIds() |
530
|
|
|
{ |
531
|
|
|
return $this->prerequisiteProductIds; |
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
/** |
535
|
|
|
* @param array $prerequisiteProductIds |
536
|
|
|
* |
537
|
|
|
* @return PriceRule |
538
|
|
|
*/ |
539
|
|
|
public function setPrerequisiteProductIds($prerequisiteProductIds) |
540
|
|
|
{ |
541
|
|
|
$this->prerequisiteProductIds = $prerequisiteProductIds; |
542
|
|
|
|
543
|
|
|
return $this; |
544
|
|
|
} |
545
|
|
|
|
546
|
|
|
/** |
547
|
|
|
* @return array |
548
|
|
|
*/ |
549
|
|
|
public function getPrerequisiteVariantIds() |
550
|
|
|
{ |
551
|
|
|
return $this->prerequisiteVariantIds; |
552
|
|
|
} |
553
|
|
|
|
554
|
|
|
/** |
555
|
|
|
* @param array $prerequisiteVariantIds |
556
|
|
|
* |
557
|
|
|
* @return PriceRule |
558
|
|
|
*/ |
559
|
|
|
public function setPrerequisiteVariantIds($prerequisiteVariantIds) |
560
|
|
|
{ |
561
|
|
|
$this->prerequisiteVariantIds = $prerequisiteVariantIds; |
562
|
|
|
|
563
|
|
|
return $this; |
564
|
|
|
} |
565
|
|
|
|
566
|
|
|
/** |
567
|
|
|
* @return array |
568
|
|
|
*/ |
569
|
|
|
public function getPrerequisiteCollectionIds() |
570
|
|
|
{ |
571
|
|
|
return $this->prerequisiteCollectionIds; |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
/** |
575
|
|
|
* @param array $prerequisiteCollectionIds |
576
|
|
|
* |
577
|
|
|
* @return PriceRule |
578
|
|
|
*/ |
579
|
|
|
public function setPrerequisiteCollectionIds($prerequisiteCollectionIds) |
580
|
|
|
{ |
581
|
|
|
$this->prerequisiteCollectionIds = $prerequisiteCollectionIds; |
582
|
|
|
|
583
|
|
|
return $this; |
584
|
|
|
} |
585
|
|
|
|
586
|
|
|
/** |
587
|
|
|
* @return int |
588
|
|
|
*/ |
589
|
|
|
public function getValue() |
590
|
|
|
{ |
591
|
|
|
return $this->value; |
592
|
|
|
} |
593
|
|
|
|
594
|
|
|
/** |
595
|
|
|
* @param int $value |
596
|
|
|
* |
597
|
|
|
* @return PriceRule |
598
|
|
|
*/ |
599
|
|
|
public function setValue($value) |
600
|
|
|
{ |
601
|
|
|
$this->value = $value; |
602
|
|
|
|
603
|
|
|
return $this; |
604
|
|
|
} |
605
|
|
|
|
606
|
|
|
/** |
607
|
|
|
* @return string |
608
|
|
|
*/ |
609
|
|
|
public function getValueType() |
610
|
|
|
{ |
611
|
|
|
return $this->valueType; |
612
|
|
|
} |
613
|
|
|
|
614
|
|
|
/** |
615
|
|
|
* @param string $valueType |
616
|
|
|
* |
617
|
|
|
* @return PriceRule |
618
|
|
|
*/ |
619
|
|
|
public function setValueType($valueType) |
620
|
|
|
{ |
621
|
|
|
$this->valueType = $valueType; |
622
|
|
|
|
623
|
|
|
return $this; |
624
|
|
|
} |
625
|
|
|
|
626
|
|
|
/** |
627
|
|
|
* @return array |
628
|
|
|
*/ |
629
|
|
|
public function getPrerequisiteToEntitlementQuantityRatio() |
630
|
|
|
{ |
631
|
|
|
return $this->prerequisiteToEntitlementQuantityRatio; |
632
|
|
|
} |
633
|
|
|
|
634
|
|
|
/** |
635
|
|
|
* @param array $prerequisiteToEntitlementQuantityRatio |
636
|
|
|
* |
637
|
|
|
* @return PriceRule |
638
|
|
|
*/ |
639
|
|
|
public function setPrerequisiteToEntitlementQuantityRatio($prerequisiteToEntitlementQuantityRatio) |
640
|
|
|
{ |
641
|
|
|
$this->prerequisiteToEntitlementQuantityRatio = $prerequisiteToEntitlementQuantityRatio; |
642
|
|
|
|
643
|
|
|
return $this; |
644
|
|
|
} |
645
|
|
|
} |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.