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\ProductVariant; |
13
|
|
|
|
14
|
|
|
use Slince\Shopify\Common\Model\Model; |
15
|
|
|
use Slince\Shopify\Common\Model\AdminGraphqlApiId; |
16
|
|
|
|
17
|
|
|
class Variant extends Model |
18
|
|
|
{ |
19
|
|
|
use AdminGraphqlApiId; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @var int |
23
|
|
|
*/ |
24
|
|
|
protected $productId; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $title; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var float |
33
|
|
|
*/ |
34
|
|
|
protected $price; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
protected $sku; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var int |
43
|
|
|
*/ |
44
|
|
|
protected $position; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var int |
48
|
|
|
*/ |
49
|
|
|
protected $grams; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
protected $inventoryPolicy; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @var string |
58
|
|
|
*/ |
59
|
|
|
protected $compareAtPrice; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var string |
63
|
|
|
*/ |
64
|
|
|
protected $fulfillmentService; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var string |
68
|
|
|
*/ |
69
|
|
|
protected $inventoryManagement; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var string |
73
|
|
|
*/ |
74
|
|
|
protected $option1; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var string |
78
|
|
|
*/ |
79
|
|
|
protected $option2; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var string |
83
|
|
|
*/ |
84
|
|
|
protected $option3; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var \DateTimeInterface |
88
|
|
|
*/ |
89
|
|
|
protected $createdAt; |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var \DateTimeInterface |
93
|
|
|
*/ |
94
|
|
|
protected $updatedAt; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @var bool |
98
|
|
|
*/ |
99
|
|
|
protected $taxable; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @var string |
103
|
|
|
*/ |
104
|
|
|
protected $barcode; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @var int |
108
|
|
|
*/ |
109
|
|
|
protected $imageId; |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @var int |
113
|
|
|
*/ |
114
|
|
|
protected $inventoryQuantity; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @var float |
118
|
|
|
*/ |
119
|
|
|
protected $weight; |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @var string |
123
|
|
|
*/ |
124
|
|
|
protected $weightUnit; |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @var int |
128
|
|
|
*/ |
129
|
|
|
protected $inventoryItemId; |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @var int |
133
|
|
|
*/ |
134
|
|
|
protected $oldInventoryQuantity; |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @var bool |
138
|
|
|
*/ |
139
|
|
|
protected $requiresShipping; |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @return int |
143
|
|
|
*/ |
144
|
|
|
public function getProductId() |
145
|
|
|
{ |
146
|
|
|
return $this->productId; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @param int $productId |
151
|
|
|
* |
152
|
|
|
* @return Variant |
153
|
|
|
*/ |
154
|
|
|
public function setProductId($productId) |
155
|
|
|
{ |
156
|
|
|
$this->productId = $productId; |
157
|
|
|
|
158
|
|
|
return $this; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return string |
163
|
|
|
*/ |
164
|
|
|
public function getTitle() |
165
|
|
|
{ |
166
|
|
|
return $this->title; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @param string $title |
171
|
|
|
* |
172
|
|
|
* @return Variant |
173
|
|
|
*/ |
174
|
|
|
public function setTitle($title) |
175
|
|
|
{ |
176
|
|
|
$this->title = $title; |
177
|
|
|
|
178
|
|
|
return $this; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @return float |
183
|
|
|
*/ |
184
|
|
|
public function getPrice() |
185
|
|
|
{ |
186
|
|
|
return $this->price; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @param float $price |
191
|
|
|
* |
192
|
|
|
* @return Variant |
193
|
|
|
*/ |
194
|
|
|
public function setPrice($price) |
195
|
|
|
{ |
196
|
|
|
$this->price = $price; |
197
|
|
|
|
198
|
|
|
return $this; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @return string |
203
|
|
|
*/ |
204
|
|
|
public function getSku() |
205
|
|
|
{ |
206
|
|
|
return $this->sku; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
/** |
210
|
|
|
* @param string $sku |
211
|
|
|
* |
212
|
|
|
* @return Variant |
213
|
|
|
*/ |
214
|
|
|
public function setSku($sku) |
215
|
|
|
{ |
216
|
|
|
$this->sku = $sku; |
217
|
|
|
|
218
|
|
|
return $this; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* @return int |
223
|
|
|
*/ |
224
|
|
|
public function getPosition() |
225
|
|
|
{ |
226
|
|
|
return $this->position; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @param int $position |
231
|
|
|
* |
232
|
|
|
* @return Variant |
233
|
|
|
*/ |
234
|
|
|
public function setPosition($position) |
235
|
|
|
{ |
236
|
|
|
$this->position = $position; |
237
|
|
|
|
238
|
|
|
return $this; |
239
|
|
|
} |
240
|
|
|
|
241
|
|
|
/** |
242
|
|
|
* @return int |
243
|
|
|
*/ |
244
|
|
|
public function getGrams() |
245
|
|
|
{ |
246
|
|
|
return $this->grams; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
/** |
250
|
|
|
* @param int $grams |
251
|
|
|
* |
252
|
|
|
* @return Variant |
253
|
|
|
*/ |
254
|
|
|
public function setGrams($grams) |
255
|
|
|
{ |
256
|
|
|
$this->grams = $grams; |
257
|
|
|
|
258
|
|
|
return $this; |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
/** |
262
|
|
|
* @return string |
263
|
|
|
*/ |
264
|
|
|
public function getInventoryPolicy() |
265
|
|
|
{ |
266
|
|
|
return $this->inventoryPolicy; |
267
|
|
|
} |
268
|
|
|
|
269
|
|
|
/** |
270
|
|
|
* @param string $inventoryPolicy |
271
|
|
|
* |
272
|
|
|
* @return Variant |
273
|
|
|
*/ |
274
|
|
|
public function setInventoryPolicy($inventoryPolicy) |
275
|
|
|
{ |
276
|
|
|
$this->inventoryPolicy = $inventoryPolicy; |
277
|
|
|
|
278
|
|
|
return $this; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* @return string |
283
|
|
|
*/ |
284
|
|
|
public function getCompareAtPrice() |
285
|
|
|
{ |
286
|
|
|
return $this->compareAtPrice; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @param string $compareAtPrice |
291
|
|
|
* |
292
|
|
|
* @return Variant |
293
|
|
|
*/ |
294
|
|
|
public function setCompareAtPrice($compareAtPrice) |
295
|
|
|
{ |
296
|
|
|
$this->compareAtPrice = $compareAtPrice; |
297
|
|
|
|
298
|
|
|
return $this; |
299
|
|
|
} |
300
|
|
|
|
301
|
|
|
/** |
302
|
|
|
* @return string |
303
|
|
|
*/ |
304
|
|
|
public function getFulfillmentService() |
305
|
|
|
{ |
306
|
|
|
return $this->fulfillmentService; |
307
|
|
|
} |
308
|
|
|
|
309
|
|
|
/** |
310
|
|
|
* @param string $fulfillmentService |
311
|
|
|
* |
312
|
|
|
* @return Variant |
313
|
|
|
*/ |
314
|
|
|
public function setFulfillmentService($fulfillmentService) |
315
|
|
|
{ |
316
|
|
|
$this->fulfillmentService = $fulfillmentService; |
317
|
|
|
|
318
|
|
|
return $this; |
319
|
|
|
} |
320
|
|
|
|
321
|
|
|
/** |
322
|
|
|
* @return string |
323
|
|
|
*/ |
324
|
|
|
public function getInventoryManagement() |
325
|
|
|
{ |
326
|
|
|
return $this->inventoryManagement; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @param string $inventoryManagement |
331
|
|
|
* |
332
|
|
|
* @return Variant |
333
|
|
|
*/ |
334
|
|
|
public function setInventoryManagement($inventoryManagement) |
335
|
|
|
{ |
336
|
|
|
$this->inventoryManagement = $inventoryManagement; |
337
|
|
|
|
338
|
|
|
return $this; |
339
|
|
|
} |
340
|
|
|
|
341
|
|
|
/** |
342
|
|
|
* @return string |
343
|
|
|
*/ |
344
|
|
|
public function getOption1() |
345
|
|
|
{ |
346
|
|
|
return $this->option1; |
347
|
|
|
} |
348
|
|
|
|
349
|
|
|
/** |
350
|
|
|
* @param string $option1 |
351
|
|
|
* |
352
|
|
|
* @return Variant |
353
|
|
|
*/ |
354
|
|
|
public function setOption1($option1) |
355
|
|
|
{ |
356
|
|
|
$this->option1 = $option1; |
357
|
|
|
|
358
|
|
|
return $this; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* @return string |
363
|
|
|
*/ |
364
|
|
|
public function getOption2() |
365
|
|
|
{ |
366
|
|
|
return $this->option2; |
367
|
|
|
} |
368
|
|
|
|
369
|
|
|
/** |
370
|
|
|
* @param string $option2 |
371
|
|
|
* |
372
|
|
|
* @return Variant |
373
|
|
|
*/ |
374
|
|
|
public function setOption2($option2) |
375
|
|
|
{ |
376
|
|
|
$this->option2 = $option2; |
377
|
|
|
|
378
|
|
|
return $this; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* @return string |
383
|
|
|
*/ |
384
|
|
|
public function getOption3() |
385
|
|
|
{ |
386
|
|
|
return $this->option3; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* @param string $option3 |
391
|
|
|
* |
392
|
|
|
* @return Variant |
393
|
|
|
*/ |
394
|
|
|
public function setOption3($option3) |
395
|
|
|
{ |
396
|
|
|
$this->option3 = $option3; |
397
|
|
|
|
398
|
|
|
return $this; |
399
|
|
|
} |
400
|
|
|
|
401
|
|
|
/** |
402
|
|
|
* @return \DateTimeInterface |
403
|
|
|
*/ |
404
|
|
|
public function getCreatedAt() |
405
|
|
|
{ |
406
|
|
|
return $this->createdAt; |
407
|
|
|
} |
408
|
|
|
|
409
|
|
|
/** |
410
|
|
|
* @param \DateTimeInterface $createdAt |
411
|
|
|
* |
412
|
|
|
* @return Variant |
413
|
|
|
*/ |
414
|
|
|
public function setCreatedAt($createdAt) |
415
|
|
|
{ |
416
|
|
|
$this->createdAt = $createdAt; |
417
|
|
|
|
418
|
|
|
return $this; |
419
|
|
|
} |
420
|
|
|
|
421
|
|
|
/** |
422
|
|
|
* @return \DateTimeInterface |
423
|
|
|
*/ |
424
|
|
|
public function getUpdatedAt() |
425
|
|
|
{ |
426
|
|
|
return $this->updatedAt; |
427
|
|
|
} |
428
|
|
|
|
429
|
|
|
/** |
430
|
|
|
* @param \DateTimeInterface $updatedAt |
431
|
|
|
* |
432
|
|
|
* @return Variant |
433
|
|
|
*/ |
434
|
|
|
public function setUpdatedAt($updatedAt) |
435
|
|
|
{ |
436
|
|
|
$this->updatedAt = $updatedAt; |
437
|
|
|
|
438
|
|
|
return $this; |
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
/** |
442
|
|
|
* @return bool |
443
|
|
|
*/ |
444
|
|
|
public function isTaxable() |
445
|
|
|
{ |
446
|
|
|
return $this->taxable; |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* @param bool $taxable |
451
|
|
|
* |
452
|
|
|
* @return Variant |
453
|
|
|
*/ |
454
|
|
|
public function setTaxable($taxable) |
455
|
|
|
{ |
456
|
|
|
$this->taxable = $taxable; |
457
|
|
|
|
458
|
|
|
return $this; |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
/** |
462
|
|
|
* @return string |
463
|
|
|
*/ |
464
|
|
|
public function getBarcode() |
465
|
|
|
{ |
466
|
|
|
return $this->barcode; |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
/** |
470
|
|
|
* @param string $barcode |
471
|
|
|
* |
472
|
|
|
* @return Variant |
473
|
|
|
*/ |
474
|
|
|
public function setBarcode($barcode) |
475
|
|
|
{ |
476
|
|
|
$this->barcode = $barcode; |
477
|
|
|
|
478
|
|
|
return $this; |
479
|
|
|
} |
480
|
|
|
|
481
|
|
|
/** |
482
|
|
|
* @return int |
483
|
|
|
*/ |
484
|
|
|
public function getImageId() |
485
|
|
|
{ |
486
|
|
|
return $this->imageId; |
487
|
|
|
} |
488
|
|
|
|
489
|
|
|
/** |
490
|
|
|
* @param int $imageId |
491
|
|
|
* |
492
|
|
|
* @return Variant |
493
|
|
|
*/ |
494
|
|
|
public function setImageId($imageId) |
495
|
|
|
{ |
496
|
|
|
$this->imageId = $imageId; |
497
|
|
|
|
498
|
|
|
return $this; |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
/** |
502
|
|
|
* @return int |
503
|
|
|
*/ |
504
|
|
|
public function getInventoryQuantity() |
505
|
|
|
{ |
506
|
|
|
return $this->inventoryQuantity; |
507
|
|
|
} |
508
|
|
|
|
509
|
|
|
/** |
510
|
|
|
* @param int $inventoryQuantity |
511
|
|
|
* |
512
|
|
|
* @return Variant |
513
|
|
|
*/ |
514
|
|
|
public function setInventoryQuantity($inventoryQuantity) |
515
|
|
|
{ |
516
|
|
|
$this->inventoryQuantity = $inventoryQuantity; |
517
|
|
|
|
518
|
|
|
return $this; |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* @return float |
523
|
|
|
*/ |
524
|
|
|
public function getWeight() |
525
|
|
|
{ |
526
|
|
|
return $this->weight; |
527
|
|
|
} |
528
|
|
|
|
529
|
|
|
/** |
530
|
|
|
* @param float $weight |
531
|
|
|
* |
532
|
|
|
* @return Variant |
533
|
|
|
*/ |
534
|
|
|
public function setWeight($weight) |
535
|
|
|
{ |
536
|
|
|
$this->weight = $weight; |
537
|
|
|
|
538
|
|
|
return $this; |
539
|
|
|
} |
540
|
|
|
|
541
|
|
|
/** |
542
|
|
|
* @return string |
543
|
|
|
*/ |
544
|
|
|
public function getWeightUnit() |
545
|
|
|
{ |
546
|
|
|
return $this->weightUnit; |
547
|
|
|
} |
548
|
|
|
|
549
|
|
|
/** |
550
|
|
|
* @param string $weightUnit |
551
|
|
|
* |
552
|
|
|
* @return Variant |
553
|
|
|
*/ |
554
|
|
|
public function setWeightUnit($weightUnit) |
555
|
|
|
{ |
556
|
|
|
$this->weightUnit = $weightUnit; |
557
|
|
|
|
558
|
|
|
return $this; |
559
|
|
|
} |
560
|
|
|
|
561
|
|
|
/** |
562
|
|
|
* @param int $inventoryItemId |
563
|
|
|
*/ |
564
|
|
|
public function setInventoryItemId($inventoryItemId) |
565
|
|
|
{ |
566
|
|
|
$this->inventoryItemId = $inventoryItemId; |
567
|
|
|
} |
568
|
|
|
|
569
|
|
|
/** |
570
|
|
|
* @return int |
571
|
|
|
*/ |
572
|
|
|
public function getInventoryItemId() |
573
|
|
|
{ |
574
|
|
|
return $this->inventoryItemId; |
575
|
|
|
} |
576
|
|
|
|
577
|
|
|
/** |
578
|
|
|
* @return int |
579
|
|
|
*/ |
580
|
|
|
public function getOldInventoryQuantity() |
581
|
|
|
{ |
582
|
|
|
return $this->oldInventoryQuantity; |
583
|
|
|
} |
584
|
|
|
|
585
|
|
|
/** |
586
|
|
|
* @param int $oldInventoryQuantity |
587
|
|
|
* |
588
|
|
|
* @return Variant |
589
|
|
|
*/ |
590
|
|
|
public function setOldInventoryQuantity($oldInventoryQuantity) |
591
|
|
|
{ |
592
|
|
|
$this->oldInventoryQuantity = $oldInventoryQuantity; |
593
|
|
|
|
594
|
|
|
return $this; |
595
|
|
|
} |
596
|
|
|
|
597
|
|
|
/** |
598
|
|
|
* @return bool |
599
|
|
|
*/ |
600
|
|
|
public function isRequiresShipping() |
601
|
|
|
{ |
602
|
|
|
return $this->requiresShipping; |
603
|
|
|
} |
604
|
|
|
|
605
|
|
|
/** |
606
|
|
|
* @param bool $requiresShipping |
607
|
|
|
* |
608
|
|
|
* @return Variant |
609
|
|
|
*/ |
610
|
|
|
public function setRequiresShipping($requiresShipping) |
611
|
|
|
{ |
612
|
|
|
$this->requiresShipping = $requiresShipping; |
613
|
|
|
|
614
|
|
|
return $this; |
615
|
|
|
} |
616
|
|
|
} |