Passed
Push — master ( e35fd1...265125 )
by Joachim
11:08
created

Product::setMedia()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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