Completed
Push — master ( c97749...e35fd1 )
by Joachim
12:56
created

Product::populateFromApiResponse()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 48
Code Lines 41

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 48
rs 9.125
c 0
b 0
f 0
cc 3
eloc 41
nc 4
nop 1
1
<?php
2
3
namespace Loevgaard\DandomainFoundation\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
use Doctrine\ORM\Mapping as ORM;
7
use Loevgaard\DandomainDateTime\DateTimeImmutable;
8
use Loevgaard\DandomainFoundation\Entity\Generated\ProductInterface;
9
use Loevgaard\DandomainFoundation\Entity\Generated\VariantInterface;
10
use Loevgaard\DandomainFoundation\Entity\Generated\ProductTrait;
11
use Loevgaard\DandomainFoundation\Entity\Generated\MediumInterface;
12
use Loevgaard\DandomainFoundation\Entity\Generated\CategoryInterface;
13
use Loevgaard\DandomainFoundation\Entity\Generated\ManufacturerInterface;
14
use Loevgaard\DandomainFoundation\Entity\Generated\PriceInterface;
15
use Loevgaard\DandomainFoundation\Entity\Generated\ProductRelationInterface;
16
use Loevgaard\DandomainFoundation\Entity\Generated\SegmentInterface;
17
use Loevgaard\DandomainFoundation\Entity\Generated\VariantGroupInterface;
18
use Loevgaard\DandomainFoundation;
19
20
/**
21
 * @ORM\Entity()
22
 * @ORM\Table(name="loevgaard_dandomain_products")
23
 */
24
class Product implements ProductInterface
25
{
26
    use ProductTrait;
27
28
    /**
29
     * @var int
30
     *
31
     * @ORM\Id
32
     * @ORM\GeneratedValue
33
     * @ORM\Column(type="integer")
34
     **/
35
    protected $id;
36
37
    /**
38
     * @var int
39
     *
40
     * @ORM\Column(type="integer", unique=true)
41
     */
42
    protected $externalId;
43
44
    /**
45
     * @var string|null
46
     *
47
     * @ORM\Column(nullable=true, type="string", length=191)
48
     */
49
    protected $barCodeNumber;
50
51
    /**
52
     * @var array|null
53
     *
54
     * @ORM\Column(nullable=true, type="json")
55
     */
56
    protected $categoryIdList;
57
58
    /**
59
     * @var string|null
60
     *
61
     * @ORM\Column(nullable=true, type="string", length=191)
62
     */
63
    protected $comments;
64
65
    /**
66
     * @var float|null
67
     *
68
     * @ORM\Column(nullable=true, type="decimal", precision=12, scale=2)
69
     */
70
    protected $costPrice;
71
72
    /**
73
     * @var \DateTimeImmutable|null
74
     *
75
     * @ORM\Column(nullable=true, type="datetime_immutable")
76
     */
77
    protected $created;
78
79
    /**
80
     * @var string|null
81
     *
82
     * @ORM\Column(nullable=true, type="string", length=191)
83
     */
84
    protected $createdBy;
85
86
    /**
87
     * @var int|null
88
     *
89
     * @ORM\Column(nullable=true, type="integer")
90
     */
91
    protected $defaultCategoryId;
92
93
    /**
94
     * @var array|null
95
     *
96
     * @ORM\Column(nullable=true, type="json")
97
     */
98
    protected $disabledVariantIdList;
99
100
    /**
101
     * @var string|null
102
     *
103
     * @ORM\Column(nullable=true, type="string", length=191)
104
     */
105
    protected $edbPriserProductNumber;
106
107
    /**
108
     * @var string|null
109
     *
110
     * @ORM\Column(nullable=true, type="string", length=191)
111
     */
112
    protected $fileSaleLink;
113
114
    /**
115
     * @var string|null
116
     *
117
     * @ORM\Column(nullable=true, type="string", length=191)
118
     */
119
    protected $googleFeedCategory;
120
121
    /**
122
     * @var bool|null
123
     *
124
     * @ORM\Column(nullable=true, type="boolean")
125
     */
126
    protected $isGiftCertificate;
127
128
    /**
129
     * @var bool|null
130
     *
131
     * @ORM\Column(nullable=true, type="boolean")
132
     */
133
    protected $isModified;
134
135
    /**
136
     * @var bool|null
137
     *
138
     * @ORM\Column(nullable=true, type="boolean")
139
     */
140
    protected $isRateVariants;
141
142
    /**
143
     * @var bool|null
144
     *
145
     * @ORM\Column(nullable=true, type="boolean")
146
     */
147
    protected $isReviewVariants;
148
149
    /**
150
     * @var bool|null
151
     *
152
     * @ORM\Column(nullable=true, type="boolean")
153
     */
154
    protected $isVariantMaster;
155
156
    /**
157
     * @var string|null
158
     *
159
     * @ORM\Column(nullable=true, type="string", length=191)
160
     */
161
    protected $locationNumber;
162
163
    /**
164
     * @var array|null
165
     *
166
     * @ORM\Column(nullable=true, type="json")
167
     */
168
    protected $manufacturereIdList;
169
170
    /**
171
     * @var int|null
172
     *
173
     * @ORM\Column(nullable=true, type="integer")
174
     */
175
    protected $maxBuyAmount;
176
177
    /**
178
     * @var int|null
179
     *
180
     * @ORM\Column(nullable=true, type="integer")
181
     */
182
    protected $minBuyAmount;
183
184
    /**
185
     * @var int|null
186
     *
187
     * @ORM\Column(nullable=true, type="integer")
188
     */
189
    protected $minBuyAmountB2B;
190
191
    /**
192
     * The product number
193
     *
194
     * @var string|null
195
     *
196
     * @ORM\Column(nullable=true, type="string", length=191)
197
     */
198
    protected $number;
199
200
    /**
201
     * @var string|null
202
     *
203
     * @ORM\Column(nullable=true, type="string", length=191)
204
     */
205
    protected $picture;
206
207
    /**
208
     * @var int|null
209
     *
210
     * @ORM\Column(nullable=true, type="integer")
211
     */
212
    protected $salesCount;
213
214
    /**
215
     * @var array|null
216
     *
217
     * @ORM\Column(nullable=true, type="json")
218
     */
219
    protected $segmentIdList;
220
221
    /**
222
     * @var int|null
223
     *
224
     * @ORM\Column(nullable=true, type="integer")
225
     */
226
    protected $sortOrder;
227
228
    /**
229
     * @var int|null
230
     *
231
     * @ORM\Column(nullable=true, type="integer")
232
     */
233
    protected $stockCount;
234
235
    /**
236
     * @var int|null
237
     *
238
     * @ORM\Column(nullable=true, type="integer")
239
     */
240
    protected $stockLimit;
241
242
    /**
243
     * @var int|null
244
     *
245
     * @ORM\Column(nullable=true, type="integer")
246
     */
247
    protected $typeId;
248
249
    /**
250
     * @var \DateTimeImmutable|null
251
     *
252
     * @ORM\Column(nullable=true, type="datetime_immutable")
253
     */
254
    protected $updated;
255
256
    /**
257
     * @var string|null
258
     *
259
     * @ORM\Column(nullable=true, type="string", length=191)
260
     */
261
    protected $updatedBy;
262
263
    /**
264
     * @var array|null
265
     *
266
     * @ORM\Column(nullable=true, type="json")
267
     */
268
    protected $variantGroupIdList;
269
270
    /**
271
     * @var array|null
272
     *
273
     * @ORM\Column(nullable=true, type="json")
274
     */
275
    protected $variantIdList;
276
277
    /**
278
     * @var int|null
279
     *
280
     * @ORM\Column(nullable=true, type="string", length=191)
281
     */
282
    protected $variantMasterId;
283
284
    /**
285
     * @var string|null
286
     *
287
     * @ORM\Column(nullable=true, type="string", length=191)
288
     */
289
    protected $vendorNumber;
290
291
    /**
292
     * @var int|null
293
     *
294
     * @ORM\Column(nullable=true, type="integer")
295
     */
296
    protected $weight;
297
298
    /**
299
     * @var Category[]|ArrayCollection
300
     */
301
    protected $categories;
302
303
    /**
304
     * @var Variant[]|ArrayCollection
305
     */
306
    protected $disabledVariants;
307
308
    /**
309
     * @var Manufacturer[]|ArrayCollection
310
     */
311
    protected $manufacturers;
312
313
    /**
314
     * @var Medium[]|ArrayCollection
315
     */
316
    protected $media;
317
318
    /**
319
     * @var Price[]|ArrayCollection
320
     */
321
    protected $prices;
322
323
    /**
324
     * @var ProductRelation[]|ArrayCollection
325
     */
326
    protected $productRelations;
327
328
    /**
329
     * @var ProductType
330
     */
331
    protected $productType;
332
333
    /**
334
     * @var Segment[]|ArrayCollection
335
     */
336
    protected $segments;
337
338
    /**
339
     * @var VariantGroup[]|ArrayCollection
340
     */
341
    protected $variantGroups;
342
343
    /**
344
     * @var Variant[]|ArrayCollection
345
     */
346
    protected $variants;
347
348
    public function __construct()
349
    {
350
        $this->categories = new ArrayCollection();
351
        $this->disabledVariants = new ArrayCollection();
352
        $this->manufacturers = new ArrayCollection();
353
        $this->media = new ArrayCollection();
354
        $this->prices = new ArrayCollection();
355
        $this->productRelations = new ArrayCollection();
356
        $this->segments = new ArrayCollection();
357
        $this->variants = new ArrayCollection();
358
        $this->variantGroups = new ArrayCollection();
359
    }
360
361
    public function addDisabledVariant(VariantInterface $variant) : ProductInterface
362
    {
363
        if(!$this->disabledVariants->contains($variant)) {
364
            $this->disabledVariants->add($variant);
365
        }
366
367
        return $this;
368
    }
369
370
    public function addMedium(MediumInterface $medium) : ProductInterface
371
    {
372
        if(!$this->media->contains($medium)) {
373
            $this->media->add($medium);
374
        }
375
376
        return $this;
377
    }
378
379
    public function addCategory(CategoryInterface $category) : ProductInterface
380
    {
381
        if(!$this->categories->contains($category)) {
382
            $this->categories->add($category);
383
        }
384
385
        return $this;
386
    }
387
388
    public function addManufacturer(ManufacturerInterface $manufacturer) : ProductInterface
389
    {
390
        if(!$this->manufacturers->contains($manufacturer)) {
391
            $this->manufacturers->add($manufacturer);
392
        }
393
394
        return $this;
395
    }
396
397
    public function addPrice(PriceInterface $price) : ProductInterface
398
    {
399
        if(!$this->prices->contains($price)) {
400
            $this->prices->add($price);
401
        }
402
403
        return $this;
404
    }
405
406
    public function addProductRelation(ProductRelationInterface $productRelation) : ProductInterface
407
    {
408
        if(!$this->productRelations->contains($productRelation)) {
409
            $this->productRelations->add($productRelation);
410
        }
411
412
        return $this;
413
    }
414
415
    public function addSegment(SegmentInterface $segment) : ProductInterface
416
    {
417
        if(!$this->segments->contains($segment)) {
418
            $this->segments->add($segment);
419
        }
420
421
        return $this;
422
    }
423
424
    public function addVariant(VariantInterface $variant) : ProductInterface
425
    {
426
        if(!$this->variants->contains($variant)) {
427
            $this->variants->add($variant);
428
        }
429
    }
430
431
    public function addVariantGroup(VariantGroupInterface $variantGroup) : ProductInterface
432
    {
433
        if(!$this->variantGroups->contains($variantGroup)) {
434
            $this->variantGroups->add($variantGroup);
435
        }
436
437
        return $this;
438
    }
439
440
    /**
441
     * Populates a product based on the response from the Dandomain API
442
     *
443
     * See the properties here:
444
     * http://4221117.shop53.dandomain.dk/admin/webapi/endpoints/v1_0/ProductDataService/help/operations/GetDataProduct
445
     *
446
     * @param \stdClass|array $data
447
     */
448
    public function populateFromApiResponse($data)
449
    {
450
        $data = DandomainFoundation\objectToArray($data);
451
452
        if ($data['created']) {
453
            $this->created = DateTimeImmutable::createFromJson($data['created']);
454
        }
455
456
        if ($data['updated']) {
457
            $this->updated = DateTimeImmutable::createFromJson($data['updated']);
458
        }
459
460
        $this
461
            ->setBarCodeNumber($data['barCodeNumber'])
462
            ->setCategoryIdList($data['categoryIdList'])
463
            ->setComments($data['comments'])
464
            ->setCostPrice($data['costPrice'])
465
            ->setCreatedBy($data['createdBy'])
466
            ->setDefaultCategoryId($data['defaultCategoryId'])
467
            ->setDisabledVariantIdList($data['disabledVariantIdList'])
468
            ->setEdbPriserProductNumber($data['edbPriserProductNumber'])
469
            ->setExternalId($data['id'])
470
            ->setFileSaleLink($data['fileSaleLink'])
471
            ->setGoogleFeedCategory($data['googleFeedCategory'])
472
            ->setIsGiftCertificate($data['isGiftCertificate'])
473
            ->setIsModified($data['isModified'])
474
            ->setIsRateVariants($data['isRateVariants'])
475
            ->setIsReviewVariants($data['isReviewVariants'])
476
            ->setIsVariantMaster($data['isVariantMaster'])
477
            ->setLocationNumber($data['locationNumber'])
478
            ->setManufacturereIdList($data['manufacturereIdList'])
479
            ->setMaxBuyAmount($data['maxBuyAmount'])
480
            ->setMinBuyAmount($data['minBuyAmount'])
481
            ->setMinBuyAmountB2B($data['minBuyAmountB2B'])
482
            ->setNumber($data['number'])
483
            ->setPicture($data['picture'])
484
            ->setSalesCount($data['salesCount'])
485
            ->setSegmentIdList($data['segmentIdList'])
486
            ->setSortOrder($data['sortOrder'])
487
            ->setStockCount($data['stockCount'])
488
            ->setStockLimit($data['stockLimit'])
489
            ->setTypeId($data['typeId'])
490
            ->setUpdatedBy($data['updatedBy'])
491
            ->setVariantGroupIdList($data['variantGroupIdList'])
492
            ->setVariantIdList($data['variantIdList'])
493
            ->setVariantMasterId($data['variantMasterId'])
494
            ->setVendorNumber($data['vendorNumber'])
495
            ->setWeight($data['weight'])
496
        ;
497
498
        /*
499
         * @todo outcomment this and fix it
500
         *
501
        if (is_array($data['disabledVariants'])) {
502
            foreach ($data['disabledVariants'] as $disabledVariantData) {
503
                $disabledVariant = new Variant();
504
                $disabledVariant->populateFromApiResponse($disabledVariantData);
505
                $this->addDisabledVariant($disabledVariant);
506
            }
507
        }
508
509
        if (is_array($data['media'])) {
510
            foreach ($data['media'] as $mediaTmp) {
511
                $medium = new Medium();
512
                $medium->populateFromApiResponse($mediaTmp);
513
                $this->addMedium($medium);
514
            }
515
        }
516
517
        if (is_array($data['productCategories'])) {
518
            foreach ($data['productCategories'] as $categoryData) {
519
                $category = new Category();
520
                $category->populateFromApiResponse($categoryData);
521
                $this->addCategory($category);
522
            }
523
        }
524
525
        if (is_array($data['manufacturers'])) {
526
            foreach ($data['manufacturers'] as $manufacturerData) {
527
                $manufacturer = new Manufacturer();
528
                $manufacturer->populateFromApiResponse($manufacturerData);
529
                $this->addManufacturer($manufacturer);
530
            }
531
        }
532
533
        if (is_array($data['prices'])) {
534
            foreach ($data['prices'] as $priceData) {
535
                $price = new Price();
536
                $price->populateFromApiResponse($priceData);
537
                $this->addPrice($price);
538
            }
539
        }
540
541
        if (is_array($data['productRelations'])) {
542
            foreach ($data['productRelations'] as $productRelationData) {
543
                $productRelation = new ProductRelation();
544
                $productRelation->populateFromApiResponse($productRelationData);
545
                $this->addProductRelation($productRelation);
546
            }
547
        }
548
549
        if ($data['productType']) {
550
            $productType = new ProductType();
551
            $productType->$productRelation($data['productType']);
552
            $this->setProductType($productType);
553
        }
554
555
        if (is_array($data['segments'])) {
556
            foreach ($data['segments'] as $segmentData) {
557
                $segment = new Segment();
558
                $segment->$productRelation($segmentData);
559
                $this->addSegment($segment);
560
            }
561
        }
562
563
        if (is_array($data['variants'])) {
564
            foreach ($data['variants'] as $variantData) {
565
                $variant = new Variant();
566
                $variant->$productRelation($variantData);
567
                $this->addVariant($variant);
568
            }
569
        }
570
571
        if (is_array($data['variantGroups'])) {
572
            foreach ($data['variantGroups'] as $variantGroupData) {
573
                $variantGroup = new VariantGroup();
574
                $variantGroup->$productRelation($variantGroupData);
575
                $this->addVariantGroup($variantGroup);
576
            }
577
        }
578
        */
579
580
        /*
581
        if (($entity instanceof TranslatableInterface) && is_array($data['siteSettings'])) {
582
            foreach ($data['siteSettings'] as $siteSettingTmp) {
583
                if ($siteSettingTmp->expectedDeliveryTime) {
584
                    try {
585
                        $expectedDeliveryTime = \Dandomain\Api\jsonDateToDate($siteSettingTmp->expectedDeliveryTime);
586
                        $expectedDeliveryTime->setTimezone(new \DateTimeZone('Europe/Copenhagen'));
587
                    } catch (\Exception $e) {
588
                        $expectedDeliveryTime = null;
589
                    }
590
                } else {
591
                    $expectedDeliveryTime = null;
592
                }
593
594
                if ($siteSettingTmp->expectedDeliveryTimeNotInStock) {
595
                    try {
596
                        $expectedDeliveryTimeNotInStock = \Dandomain\Api\jsonDateToDate($siteSettingTmp->expectedDeliveryTimeNotInStock);
597
                        $expectedDeliveryTimeNotInStock->setTimezone(new \DateTimeZone('Europe/Copenhagen'));
598
                    } catch (\Exception $e) {
599
                        $expectedDeliveryTimeNotInStock = null;
600
                    }
601
                } else {
602
                    $expectedDeliveryTimeNotInStock = null;
603
                }
604
605
                $entity->translate($siteSettingTmp->siteID)->setCustomField01($siteSettingTmp->customField01);
606
                $entity->translate($siteSettingTmp->siteID)->setCustomField02($siteSettingTmp->customField02);
607
                $entity->translate($siteSettingTmp->siteID)->setCustomField03($siteSettingTmp->customField03);
608
                $entity->translate($siteSettingTmp->siteID)->setCustomField04($siteSettingTmp->customField04);
609
                $entity->translate($siteSettingTmp->siteID)->setCustomField05($siteSettingTmp->customField05);
610
                $entity->translate($siteSettingTmp->siteID)->setCustomField06($siteSettingTmp->customField06);
611
                $entity->translate($siteSettingTmp->siteID)->setCustomField07($siteSettingTmp->customField07);
612
                $entity->translate($siteSettingTmp->siteID)->setCustomField08($siteSettingTmp->customField08);
613
                $entity->translate($siteSettingTmp->siteID)->setCustomField09($siteSettingTmp->customField09);
614
                $entity->translate($siteSettingTmp->siteID)->setCustomField10($siteSettingTmp->customField10);
615
                $entity->translate($siteSettingTmp->siteID)->setGiftCertificatePdfBackgroundImage($siteSettingTmp->giftCertificatePdfBackgroundImage);
616
                $entity->translate($siteSettingTmp->siteID)->setHidden($siteSettingTmp->hidden);
617
                $entity->translate($siteSettingTmp->siteID)->setHiddenForMobile($siteSettingTmp->hiddenForMobile);
618
                $entity->translate($siteSettingTmp->siteID)->setImageAltText($siteSettingTmp->imageAltText);
619
                $entity->translate($siteSettingTmp->siteID)->setIsToplistHidden($siteSettingTmp->isToplistHidden);
620
                $entity->translate($siteSettingTmp->siteID)->setKeyWords($siteSettingTmp->keyWords);
621
                $entity->translate($siteSettingTmp->siteID)->setLongDescription($siteSettingTmp->longDescription);
622
                $entity->translate($siteSettingTmp->siteID)->setLongDescription2($siteSettingTmp->longDescription2);
623
                $entity->translate($siteSettingTmp->siteID)->setMetaDescription($siteSettingTmp->metaDescription);
624
                $entity->translate($siteSettingTmp->siteID)->setName($siteSettingTmp->name);
625
                $entity->translate($siteSettingTmp->siteID)->setPageTitle($siteSettingTmp->pageTitle);
626
                $entity->translate($siteSettingTmp->siteID)->setRememberToBuyTextHeading($siteSettingTmp->rememberToBuyTextHeading);
627
                $entity->translate($siteSettingTmp->siteID)->setRememberToBuyTextSubheading($siteSettingTmp->rememberToBuyTextSubheading);
628
                $entity->translate($siteSettingTmp->siteID)->setRetailSalesPrice($siteSettingTmp->retailSalesPrice);
629
                $entity->translate($siteSettingTmp->siteID)->setShortDescription($siteSettingTmp->shortDescription);
630
                $entity->translate($siteSettingTmp->siteID)->setShowAsNew($siteSettingTmp->showAsNew);
631
                $entity->translate($siteSettingTmp->siteID)->setShowOnFrontPage($siteSettingTmp->showOnFrontPage);
632
                $entity->translate($siteSettingTmp->siteID)->setSiteId($siteSettingTmp->siteID);
633
                $entity->translate($siteSettingTmp->siteID)->setSortOrder($siteSettingTmp->sortOrder);
634
                $entity->translate($siteSettingTmp->siteID)->setTechDocLink($siteSettingTmp->techDocLink);
635
                $entity->translate($siteSettingTmp->siteID)->setTechDocLink2($siteSettingTmp->techDocLink2);
636
                $entity->translate($siteSettingTmp->siteID)->setTechDocLink3($siteSettingTmp->techDocLink3);
637
                $entity->translate($siteSettingTmp->siteID)->setUnitNumber($siteSettingTmp->unitNumber);
638
                $entity->translate($siteSettingTmp->siteID)->setUrlname($siteSettingTmp->urlname);
639
640
                if (null !== $expectedDeliveryTime) {
641
                    $entity->translate($siteSettingTmp->siteID)->setExpectedDeliveryTime($expectedDeliveryTime);
642
                }
643
644
                if (null !== $expectedDeliveryTimeNotInStock) {
645
                    $entity->translate($siteSettingTmp->siteID)->setExpectedDeliveryTimeNotInStock($expectedDeliveryTimeNotInStock);
646
                }
647
648
                if ($siteSettingTmp->periodFrontPage) {
649
                    $periodFrontPage = $this->periodSynchronizer->syncPeriod($siteSettingTmp->periodFrontPage, $flush);
650
                    $entity->translate($siteSettingTmp->siteID)->setPeriodFrontPage($periodFrontPage);
651
                }
652
653
                if ($siteSettingTmp->periodHidden) {
654
                    $periodHidden = $this->periodSynchronizer->syncPeriod($siteSettingTmp->periodHidden, $flush);
655
                    $entity->translate($siteSettingTmp->siteID)->setPeriodHidden($periodHidden);
656
                }
657
658
                if ($siteSettingTmp->periodNew) {
659
                    $periodNew = $this->periodSynchronizer->syncPeriod($siteSettingTmp->periodNew, $flush);
660
                    $entity->translate($siteSettingTmp->siteID)->setPeriodNew($periodNew);
661
                }
662
663
                if ($siteSettingTmp->unit) {
664
                    $unit = $this->unitSynchronizer->syncUnit($siteSettingTmp->unit, $flush);
665
                    $entity->translate($siteSettingTmp->siteID)->setUnit($unit);
666
                }
667
668
                $entity->mergeNewTranslations();
669
            }
670
        }
671
672
        */
673
    }
674
675
    /**
676
     * @return int
677
     */
678
    public function getId(): int
679
    {
680
        return (int)$this->id;
681
    }
682
683
    /**
684
     * @param int $id
685
     * @return Product
686
     */
687
    public function setId(int $id)
688
    {
689
        $this->id = $id;
690
        return $this;
691
    }
692
693
    /**
694
     * @return int
695
     */
696
    public function getExternalId(): int
697
    {
698
        return (int)$this->externalId;
699
    }
700
701
    /**
702
     * @param int $externalId
703
     * @return Product
704
     */
705
    public function setExternalId(int $externalId)
706
    {
707
        $this->externalId = $externalId;
708
        return $this;
709
    }
710
711
    /**
712
     * @return null|string
713
     */
714
    public function getBarCodeNumber()
715
    {
716
        return $this->barCodeNumber;
717
    }
718
719
    /**
720
     * @param null|string $barCodeNumber
721
     * @return Product
722
     */
723
    public function setBarCodeNumber($barCodeNumber)
724
    {
725
        $this->barCodeNumber = $barCodeNumber;
726
        return $this;
727
    }
728
729
    /**
730
     * @return array|null
731
     */
732
    public function getCategoryIdList()
733
    {
734
        return $this->categoryIdList;
735
    }
736
737
    /**
738
     * @param array|null $categoryIdList
739
     * @return Product
740
     */
741
    public function setCategoryIdList($categoryIdList)
742
    {
743
        $this->categoryIdList = $categoryIdList;
744
        return $this;
745
    }
746
747
    /**
748
     * @return null|string
749
     */
750
    public function getComments()
751
    {
752
        return $this->comments;
753
    }
754
755
    /**
756
     * @param null|string $comments
757
     * @return Product
758
     */
759
    public function setComments($comments)
760
    {
761
        $this->comments = $comments;
762
        return $this;
763
    }
764
765
    /**
766
     * @return float|null
767
     */
768
    public function getCostPrice()
769
    {
770
        return $this->costPrice;
771
    }
772
773
    /**
774
     * @param float|null $costPrice
775
     * @return Product
776
     */
777
    public function setCostPrice($costPrice)
778
    {
779
        $this->costPrice = $costPrice;
780
        return $this;
781
    }
782
783
    /**
784
     * @return \DateTimeImmutable|null
785
     */
786
    public function getCreated()
787
    {
788
        return $this->created;
789
    }
790
791
    /**
792
     * @param \DateTimeImmutable|null $created
793
     * @return Product
794
     */
795
    public function setCreated($created)
796
    {
797
        $this->created = $created;
798
        return $this;
799
    }
800
801
    /**
802
     * @return null|string
803
     */
804
    public function getCreatedBy()
805
    {
806
        return $this->createdBy;
807
    }
808
809
    /**
810
     * @param null|string $createdBy
811
     * @return Product
812
     */
813
    public function setCreatedBy($createdBy)
814
    {
815
        $this->createdBy = $createdBy;
816
        return $this;
817
    }
818
819
    /**
820
     * @return int|null
821
     */
822
    public function getDefaultCategoryId()
823
    {
824
        return $this->defaultCategoryId;
825
    }
826
827
    /**
828
     * @param int|null $defaultCategoryId
829
     * @return Product
830
     */
831
    public function setDefaultCategoryId($defaultCategoryId)
832
    {
833
        $this->defaultCategoryId = $defaultCategoryId;
834
        return $this;
835
    }
836
837
    /**
838
     * @return array|null
839
     */
840
    public function getDisabledVariantIdList()
841
    {
842
        return $this->disabledVariantIdList;
843
    }
844
845
    /**
846
     * @param array|null $disabledVariantIdList
847
     * @return Product
848
     */
849
    public function setDisabledVariantIdList($disabledVariantIdList)
850
    {
851
        $this->disabledVariantIdList = $disabledVariantIdList;
852
        return $this;
853
    }
854
855
    /**
856
     * @return null|string
857
     */
858
    public function getEdbPriserProductNumber()
859
    {
860
        return $this->edbPriserProductNumber;
861
    }
862
863
    /**
864
     * @param null|string $edbPriserProductNumber
865
     * @return Product
866
     */
867
    public function setEdbPriserProductNumber($edbPriserProductNumber)
868
    {
869
        $this->edbPriserProductNumber = $edbPriserProductNumber;
870
        return $this;
871
    }
872
873
    /**
874
     * @return null|string
875
     */
876
    public function getFileSaleLink()
877
    {
878
        return $this->fileSaleLink;
879
    }
880
881
    /**
882
     * @param null|string $fileSaleLink
883
     * @return Product
884
     */
885
    public function setFileSaleLink($fileSaleLink)
886
    {
887
        $this->fileSaleLink = $fileSaleLink;
888
        return $this;
889
    }
890
891
    /**
892
     * @return null|string
893
     */
894
    public function getGoogleFeedCategory()
895
    {
896
        return $this->googleFeedCategory;
897
    }
898
899
    /**
900
     * @param null|string $googleFeedCategory
901
     * @return Product
902
     */
903
    public function setGoogleFeedCategory($googleFeedCategory)
904
    {
905
        $this->googleFeedCategory = $googleFeedCategory;
906
        return $this;
907
    }
908
909
    /**
910
     * @return bool|null
911
     */
912
    public function getisGiftCertificate()
913
    {
914
        return $this->isGiftCertificate;
915
    }
916
917
    /**
918
     * @param bool|null $isGiftCertificate
919
     * @return Product
920
     */
921
    public function setIsGiftCertificate($isGiftCertificate)
922
    {
923
        $this->isGiftCertificate = $isGiftCertificate;
924
        return $this;
925
    }
926
927
    /**
928
     * @return bool|null
929
     */
930
    public function getisModified()
931
    {
932
        return $this->isModified;
933
    }
934
935
    /**
936
     * @param bool|null $isModified
937
     * @return Product
938
     */
939
    public function setIsModified($isModified)
940
    {
941
        $this->isModified = $isModified;
942
        return $this;
943
    }
944
945
    /**
946
     * @return bool|null
947
     */
948
    public function getisRateVariants()
949
    {
950
        return $this->isRateVariants;
951
    }
952
953
    /**
954
     * @param bool|null $isRateVariants
955
     * @return Product
956
     */
957
    public function setIsRateVariants($isRateVariants)
958
    {
959
        $this->isRateVariants = $isRateVariants;
960
        return $this;
961
    }
962
963
    /**
964
     * @return bool|null
965
     */
966
    public function getisReviewVariants()
967
    {
968
        return $this->isReviewVariants;
969
    }
970
971
    /**
972
     * @param bool|null $isReviewVariants
973
     * @return Product
974
     */
975
    public function setIsReviewVariants($isReviewVariants)
976
    {
977
        $this->isReviewVariants = $isReviewVariants;
978
        return $this;
979
    }
980
981
    /**
982
     * @return bool|null
983
     */
984
    public function getisVariantMaster()
985
    {
986
        return $this->isVariantMaster;
987
    }
988
989
    /**
990
     * @param bool|null $isVariantMaster
991
     * @return Product
992
     */
993
    public function setIsVariantMaster($isVariantMaster)
994
    {
995
        $this->isVariantMaster = $isVariantMaster;
996
        return $this;
997
    }
998
999
    /**
1000
     * @return null|string
1001
     */
1002
    public function getLocationNumber()
1003
    {
1004
        return $this->locationNumber;
1005
    }
1006
1007
    /**
1008
     * @param null|string $locationNumber
1009
     * @return Product
1010
     */
1011
    public function setLocationNumber($locationNumber)
1012
    {
1013
        $this->locationNumber = $locationNumber;
1014
        return $this;
1015
    }
1016
1017
    /**
1018
     * @return array|null
1019
     */
1020
    public function getManufacturereIdList()
1021
    {
1022
        return $this->manufacturereIdList;
1023
    }
1024
1025
    /**
1026
     * @param array|null $manufacturereIdList
1027
     * @return Product
1028
     */
1029
    public function setManufacturereIdList($manufacturereIdList)
1030
    {
1031
        $this->manufacturereIdList = $manufacturereIdList;
1032
        return $this;
1033
    }
1034
1035
    /**
1036
     * @return int|null
1037
     */
1038
    public function getMaxBuyAmount()
1039
    {
1040
        return $this->maxBuyAmount;
1041
    }
1042
1043
    /**
1044
     * @param int|null $maxBuyAmount
1045
     * @return Product
1046
     */
1047
    public function setMaxBuyAmount($maxBuyAmount)
1048
    {
1049
        $this->maxBuyAmount = $maxBuyAmount;
1050
        return $this;
1051
    }
1052
1053
    /**
1054
     * @return int|null
1055
     */
1056
    public function getMinBuyAmount()
1057
    {
1058
        return $this->minBuyAmount;
1059
    }
1060
1061
    /**
1062
     * @param int|null $minBuyAmount
1063
     * @return Product
1064
     */
1065
    public function setMinBuyAmount($minBuyAmount)
1066
    {
1067
        $this->minBuyAmount = $minBuyAmount;
1068
        return $this;
1069
    }
1070
1071
    /**
1072
     * @return int|null
1073
     */
1074
    public function getMinBuyAmountB2B()
1075
    {
1076
        return $this->minBuyAmountB2B;
1077
    }
1078
1079
    /**
1080
     * @param int|null $minBuyAmountB2B
1081
     * @return Product
1082
     */
1083
    public function setMinBuyAmountB2B($minBuyAmountB2B)
1084
    {
1085
        $this->minBuyAmountB2B = $minBuyAmountB2B;
1086
        return $this;
1087
    }
1088
1089
    /**
1090
     * @return null|string
1091
     */
1092
    public function getNumber()
1093
    {
1094
        return $this->number;
1095
    }
1096
1097
    /**
1098
     * @param null|string $number
1099
     * @return Product
1100
     */
1101
    public function setNumber($number)
1102
    {
1103
        $this->number = $number;
1104
        return $this;
1105
    }
1106
1107
    /**
1108
     * @return null|string
1109
     */
1110
    public function getPicture()
1111
    {
1112
        return $this->picture;
1113
    }
1114
1115
    /**
1116
     * @param null|string $picture
1117
     * @return Product
1118
     */
1119
    public function setPicture($picture)
1120
    {
1121
        $this->picture = $picture;
1122
        return $this;
1123
    }
1124
1125
    /**
1126
     * @return int|null
1127
     */
1128
    public function getSalesCount()
1129
    {
1130
        return $this->salesCount;
1131
    }
1132
1133
    /**
1134
     * @param int|null $salesCount
1135
     * @return Product
1136
     */
1137
    public function setSalesCount($salesCount)
1138
    {
1139
        $this->salesCount = $salesCount;
1140
        return $this;
1141
    }
1142
1143
    /**
1144
     * @return array|null
1145
     */
1146
    public function getSegmentIdList()
1147
    {
1148
        return $this->segmentIdList;
1149
    }
1150
1151
    /**
1152
     * @param array|null $segmentIdList
1153
     * @return Product
1154
     */
1155
    public function setSegmentIdList($segmentIdList)
1156
    {
1157
        $this->segmentIdList = $segmentIdList;
1158
        return $this;
1159
    }
1160
1161
    /**
1162
     * @return int|null
1163
     */
1164
    public function getSortOrder()
1165
    {
1166
        return $this->sortOrder;
1167
    }
1168
1169
    /**
1170
     * @param int|null $sortOrder
1171
     * @return Product
1172
     */
1173
    public function setSortOrder($sortOrder)
1174
    {
1175
        $this->sortOrder = $sortOrder;
1176
        return $this;
1177
    }
1178
1179
    /**
1180
     * @return int|null
1181
     */
1182
    public function getStockCount()
1183
    {
1184
        return $this->stockCount;
1185
    }
1186
1187
    /**
1188
     * @param int|null $stockCount
1189
     * @return Product
1190
     */
1191
    public function setStockCount($stockCount)
1192
    {
1193
        $this->stockCount = $stockCount;
1194
        return $this;
1195
    }
1196
1197
    /**
1198
     * @return int|null
1199
     */
1200
    public function getStockLimit()
1201
    {
1202
        return $this->stockLimit;
1203
    }
1204
1205
    /**
1206
     * @param int|null $stockLimit
1207
     * @return Product
1208
     */
1209
    public function setStockLimit($stockLimit)
1210
    {
1211
        $this->stockLimit = $stockLimit;
1212
        return $this;
1213
    }
1214
1215
    /**
1216
     * @return int|null
1217
     */
1218
    public function getTypeId()
1219
    {
1220
        return $this->typeId;
1221
    }
1222
1223
    /**
1224
     * @param int|null $typeId
1225
     * @return Product
1226
     */
1227
    public function setTypeId($typeId)
1228
    {
1229
        $this->typeId = $typeId;
1230
        return $this;
1231
    }
1232
1233
    /**
1234
     * @return \DateTimeImmutable|null
1235
     */
1236
    public function getUpdated()
1237
    {
1238
        return $this->updated;
1239
    }
1240
1241
    /**
1242
     * @param \DateTimeImmutable|null $updated
1243
     * @return Product
1244
     */
1245
    public function setUpdated($updated)
1246
    {
1247
        $this->updated = $updated;
1248
        return $this;
1249
    }
1250
1251
    /**
1252
     * @return null|string
1253
     */
1254
    public function getUpdatedBy()
1255
    {
1256
        return $this->updatedBy;
1257
    }
1258
1259
    /**
1260
     * @param null|string $updatedBy
1261
     * @return Product
1262
     */
1263
    public function setUpdatedBy($updatedBy)
1264
    {
1265
        $this->updatedBy = $updatedBy;
1266
        return $this;
1267
    }
1268
1269
    /**
1270
     * @return array|null
1271
     */
1272
    public function getVariantGroupIdList()
1273
    {
1274
        return $this->variantGroupIdList;
1275
    }
1276
1277
    /**
1278
     * @param array|null $variantGroupIdList
1279
     * @return Product
1280
     */
1281
    public function setVariantGroupIdList($variantGroupIdList)
1282
    {
1283
        $this->variantGroupIdList = $variantGroupIdList;
1284
        return $this;
1285
    }
1286
1287
    /**
1288
     * @return array|null
1289
     */
1290
    public function getVariantIdList()
1291
    {
1292
        return $this->variantIdList;
1293
    }
1294
1295
    /**
1296
     * @param array|null $variantIdList
1297
     * @return Product
1298
     */
1299
    public function setVariantIdList($variantIdList)
1300
    {
1301
        $this->variantIdList = $variantIdList;
1302
        return $this;
1303
    }
1304
1305
    /**
1306
     * @return int|null
1307
     */
1308
    public function getVariantMasterId()
1309
    {
1310
        return $this->variantMasterId;
1311
    }
1312
1313
    /**
1314
     * @param int|null $variantMasterId
1315
     * @return Product
1316
     */
1317
    public function setVariantMasterId($variantMasterId)
1318
    {
1319
        $this->variantMasterId = $variantMasterId;
1320
        return $this;
1321
    }
1322
1323
    /**
1324
     * @return null|string
1325
     */
1326
    public function getVendorNumber()
1327
    {
1328
        return $this->vendorNumber;
1329
    }
1330
1331
    /**
1332
     * @param null|string $vendorNumber
1333
     * @return Product
1334
     */
1335
    public function setVendorNumber($vendorNumber)
1336
    {
1337
        $this->vendorNumber = $vendorNumber;
1338
        return $this;
1339
    }
1340
1341
    /**
1342
     * @return int|null
1343
     */
1344
    public function getWeight()
1345
    {
1346
        return $this->weight;
1347
    }
1348
1349
    /**
1350
     * @param int|null $weight
1351
     * @return Product
1352
     */
1353
    public function setWeight($weight)
1354
    {
1355
        $this->weight = $weight;
1356
        return $this;
1357
    }
1358
1359
    /**
1360
     * @return ArrayCollection|Category[]
1361
     */
1362
    public function getCategories()
1363
    {
1364
        return $this->categories;
1365
    }
1366
1367
    /**
1368
     * @param ArrayCollection|Category[] $categories
1369
     * @return Product
1370
     */
1371
    public function setCategories($categories)
1372
    {
1373
        $this->categories = $categories;
1374
        return $this;
1375
    }
1376
1377
    /**
1378
     * @return ArrayCollection|Variant[]
1379
     */
1380
    public function getDisabledVariants()
1381
    {
1382
        return $this->disabledVariants;
1383
    }
1384
1385
    /**
1386
     * @param ArrayCollection|Variant[] $disabledVariants
1387
     * @return Product
1388
     */
1389
    public function setDisabledVariants($disabledVariants)
1390
    {
1391
        $this->disabledVariants = $disabledVariants;
1392
        return $this;
1393
    }
1394
1395
    /**
1396
     * @return ArrayCollection|Manufacturer[]
1397
     */
1398
    public function getManufacturers()
1399
    {
1400
        return $this->manufacturers;
1401
    }
1402
1403
    /**
1404
     * @param ArrayCollection|Manufacturer[] $manufacturers
1405
     * @return Product
1406
     */
1407
    public function setManufacturers($manufacturers)
1408
    {
1409
        $this->manufacturers = $manufacturers;
1410
        return $this;
1411
    }
1412
1413
    /**
1414
     * @return ArrayCollection|Medium[]
1415
     */
1416
    public function getMedia()
1417
    {
1418
        return $this->media;
1419
    }
1420
1421
    /**
1422
     * @param ArrayCollection|Medium[] $media
1423
     * @return Product
1424
     */
1425
    public function setMedia($media)
1426
    {
1427
        $this->media = $media;
1428
        return $this;
1429
    }
1430
1431
    /**
1432
     * @return ArrayCollection|Price[]
1433
     */
1434
    public function getPrices()
1435
    {
1436
        return $this->prices;
1437
    }
1438
1439
    /**
1440
     * @param ArrayCollection|Price[] $prices
1441
     * @return Product
1442
     */
1443
    public function setPrices($prices)
1444
    {
1445
        $this->prices = $prices;
1446
        return $this;
1447
    }
1448
1449
    /**
1450
     * @return ArrayCollection|ProductRelation[]
1451
     */
1452
    public function getProductRelations()
1453
    {
1454
        return $this->productRelations;
1455
    }
1456
1457
    /**
1458
     * @param ArrayCollection|ProductRelation[] $productRelations
1459
     * @return Product
1460
     */
1461
    public function setProductRelations($productRelations)
1462
    {
1463
        $this->productRelations = $productRelations;
1464
        return $this;
1465
    }
1466
1467
    /**
1468
     * @return ProductType
1469
     */
1470
    public function getProductType(): ProductType
1471
    {
1472
        return $this->productType;
1473
    }
1474
1475
    /**
1476
     * @param ProductType $productType
1477
     * @return Product
1478
     */
1479
    public function setProductType(ProductType $productType)
1480
    {
1481
        $this->productType = $productType;
1482
        return $this;
1483
    }
1484
1485
    /**
1486
     * @return ArrayCollection|Segment[]
1487
     */
1488
    public function getSegments()
1489
    {
1490
        return $this->segments;
1491
    }
1492
1493
    /**
1494
     * @param ArrayCollection|Segment[] $segments
1495
     * @return Product
1496
     */
1497
    public function setSegments($segments)
1498
    {
1499
        $this->segments = $segments;
1500
        return $this;
1501
    }
1502
1503
    /**
1504
     * @return ArrayCollection|VariantGroup[]
1505
     */
1506
    public function getVariantGroups()
1507
    {
1508
        return $this->variantGroups;
1509
    }
1510
1511
    /**
1512
     * @param ArrayCollection|VariantGroup[] $variantGroups
1513
     * @return Product
1514
     */
1515
    public function setVariantGroups($variantGroups)
1516
    {
1517
        $this->variantGroups = $variantGroups;
1518
        return $this;
1519
    }
1520
1521
    /**
1522
     * @return ArrayCollection|Variant[]
1523
     */
1524
    public function getVariants()
1525
    {
1526
        return $this->variants;
1527
    }
1528
1529
    /**
1530
     * @param ArrayCollection|Variant[] $variants
1531
     * @return Product
1532
     */
1533
    public function setVariants($variants)
1534
    {
1535
        $this->variants = $variants;
1536
        return $this;
1537
    }
1538
}
1539