Completed
Push — master ( b11c24...01340a )
by Joachim
13:49
created

Product::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Loevgaard\DandomainFoundation\Entity;
4
5
use Assert\Assert;
6
use Doctrine\Common\Collections\ArrayCollection;
7
use Doctrine\ORM\Mapping as ORM;
8
use Knp\DoctrineBehaviors\Model\SoftDeletable\SoftDeletable;
9
use Knp\DoctrineBehaviors\Model\Timestampable\Timestampable;
10
use Knp\DoctrineBehaviors\Model\Translatable\Translatable;
11
use Loevgaard\DandomainFoundation\Entity\Generated\CategoryInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...rated\CategoryInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Loevgaard\DandomainFoundation\Entity\Generated\ManufacturerInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...d\ManufacturerInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Loevgaard\DandomainFoundation\Entity\Generated\MediumInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...nerated\MediumInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use Loevgaard\DandomainFoundation\Entity\Generated\PriceInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...enerated\PriceInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use Loevgaard\DandomainFoundation\Entity\Generated\ProductInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...erated\ProductInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use Loevgaard\DandomainFoundation\Entity\Generated\ProductRelationInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...roductRelationInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
use Loevgaard\DandomainFoundation\Entity\Generated\ProductTrait;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...\Generated\ProductTrait was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
use Loevgaard\DandomainFoundation\Entity\Generated\ProductTranslationInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...uctTranslationInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use Loevgaard\DandomainFoundation\Entity\Generated\ProductTypeInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...ed\ProductTypeInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
20
use Loevgaard\DandomainFoundation\Entity\Generated\SegmentInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...erated\SegmentInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
21
use Loevgaard\DandomainFoundation\Entity\Generated\VariantGroupInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...d\VariantGroupInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
22
use Loevgaard\DandomainFoundation\Entity\Generated\VariantInterface;
0 ignored issues
show
Bug introduced by
The type Loevgaard\DandomainFound...erated\VariantInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

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