Completed
Push — master ( d19d30...257f70 )
by Joachim
13:38
created

Product::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
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
    public function __toString()
405
    {
406
        return (string)$this->number;
407
    }
408
409
    /**
410
     * @ORM\PrePersist()
411
     * @ORM\PreUpdate()
412
     */
413
    public function validate()
414
    {
415
        Assert::that($this->number)
416
            ->string('The number needs to be string', 'number')
417
            ->maxLength(191, 'The number must have a max length of 191');
418
        Assert::thatNullOr($this->externalId)->integer('The external id can only be null or an integer', 'externalId');
419
420
        if(is_null($this->externalId)) {
421
            Assert::that($this->isDeleted())->true('The external id can only be null if the product is marked as deleted', 'externalId');
422
        }
423
    }
424
425
    public function hydrate(array $data, bool $useConversions = false, $scalarsOnly = true)
426
    {
427
        if (isset($data['created'])) {
428
            $data['created'] = $this->getDateTimeFromJson($data['created']);
429
        }
430
431
        if (isset($data['updated'])) {
432
            $data['updated'] = $this->getDateTimeFromJson($data['updated']);
433
        }
434
435
        parent::hydrate($data, $useConversions, $scalarsOnly);
436
    }
437
438
    /*
439
     * Collection/relation methods
440
     */
441
442
    public function addDisabledVariant(VariantInterface $variant) : ProductInterface
443
    {
444
        if (!$this->disabledVariants->contains($variant)) {
445
            $this->disabledVariants->add($variant);
446
        }
447
448
        return $this;
449
    }
450
451
    public function addMedium(MediumInterface $medium) : ProductInterface
452
    {
453
        if (!$this->media->contains($medium)) {
454
            $this->media->add($medium);
455
        }
456
457
        return $this;
458
    }
459
460
    public function addCategory(CategoryInterface $category) : ProductInterface
461
    {
462
        if (!$this->categories->contains($category)) {
463
            $this->categories->add($category);
464
        }
465
466
        return $this;
467
    }
468
469
    public function addManufacturer(ManufacturerInterface $manufacturer) : ProductInterface
470
    {
471
        if (!$this->hasManufacturer($manufacturer)) {
472
            $this->manufacturers->add($manufacturer);
473
        }
474
475
        return $this;
476
    }
477
478
    public function removeManufacturer(ManufacturerInterface $manufacturer) : bool
479
    {
480
        return $this->manufacturers->removeElement($manufacturer);
481
    }
482
483
    public function hasManufacturer(ManufacturerInterface $manufacturer) : bool
484
    {
485
        return $this->manufacturers->exists(function ($key, ManufacturerInterface $element) use ($manufacturer) {
486
            return $element->getExternalId() === $manufacturer->getExternalId();
487
        });
488
    }
489
490
    public function addVariantGroup(VariantGroupInterface $variantGroup) : ProductInterface
491
    {
492
        if (!$this->hasVariantGroup($variantGroup)) {
493
            $this->variantGroups->add($variantGroup);
494
        }
495
496
        return $this;
497
    }
498
499
    public function removeVariantGroup(VariantGroupInterface $variantGroup) : bool
500
    {
501
        return $this->variantGroups->removeElement($variantGroup);
502
    }
503
504
    public function hasVariantGroup($variantGroup) : bool
505
    {
506
        if ($variantGroup instanceof VariantGroupInterface) {
507
            $variantGroup = $variantGroup->getExternalId();
508
        }
509
510
        return $this->variantGroups->exists(function ($key, VariantGroupInterface $element) use ($variantGroup) {
511
            return $element->getExternalId() === $variantGroup;
512
        });
513
    }
514
515
    public function addPrice(PriceInterface $price) : ProductInterface
516
    {
517
        if (!$this->prices->contains($price)) {
518
            $this->prices->add($price);
519
        }
520
521
        return $this;
522
    }
523
524
    public function addProductRelation(ProductRelationInterface $productRelation) : ProductInterface
525
    {
526
        if (!$this->productRelations->contains($productRelation)) {
527
            $this->productRelations->add($productRelation);
528
        }
529
530
        return $this;
531
    }
532
533
    public function addSegment(SegmentInterface $segment) : ProductInterface
534
    {
535
        if (!$this->segments->contains($segment)) {
536
            $this->segments->add($segment);
537
        }
538
539
        return $this;
540
    }
541
542
    public function addVariant(VariantInterface $variant) : ProductInterface
543
    {
544
        if (!$this->variants->contains($variant)) {
545
            $this->variants->add($variant);
546
        }
547
548
        return $this;
549
    }
550
551
    public function addChild(ProductInterface $product) : ProductInterface
552
    {
553
        if (!$this->hasChild($product)) {
554
            $this->children->add($product);
555
            $product->setParent($this);
556
        }
557
558
        return $this;
559
    }
560
561
    public function removeChild(ProductInterface $product) : bool
562
    {
563
        $product->setParent(null);
564
        return $this->children->removeElement($product);
565
    }
566
567
    public function hasChild($product) : bool
568
    {
569
        if($product instanceof ProductInterface) {
570
            $product = $product->getExternalId();
571
        }
572
573
        return $this->children->exists(function ($key, ProductInterface $element) use ($product) {
574
            return $element->getExternalId() === $product;
575
        });
576
    }
577
578
    /*
579
     * Getters / Setters
580
     */
581
    /**
582
     * @return int
583
     */
584
    public function getId(): int
585
    {
586
        return (int)$this->id;
587
    }
588
589
    /**
590
     * @param int $id
591
     * @return ProductInterface
592
     */
593
    public function setId(int $id)
594
    {
595
        $this->id = $id;
596
        return $this;
597
    }
598
599
    /**
600
     * @return int
601
     */
602
    public function getExternalId(): int
603
    {
604
        return (int)$this->externalId;
605
    }
606
607
    /**
608
     * @param int $externalId
609
     * @return ProductInterface
610
     */
611
    public function setExternalId(int $externalId)
612
    {
613
        $this->externalId = $externalId;
614
        return $this;
615
    }
616
617
    /**
618
     * @return null|string
619
     */
620
    public function getBarCodeNumber()
621
    {
622
        return $this->barCodeNumber;
623
    }
624
625
    /**
626
     * @param null|string $barCodeNumber
627
     * @return ProductInterface
628
     */
629
    public function setBarCodeNumber($barCodeNumber)
630
    {
631
        $this->barCodeNumber = $barCodeNumber;
632
        return $this;
633
    }
634
635
    /**
636
     * @return array|null
637
     */
638
    public function getCategoryIdList()
639
    {
640
        return $this->categoryIdList;
641
    }
642
643
    /**
644
     * @param array|null $categoryIdList
645
     * @return ProductInterface
646
     */
647
    public function setCategoryIdList($categoryIdList)
648
    {
649
        $this->categoryIdList = $categoryIdList;
650
        return $this;
651
    }
652
653
    /**
654
     * @return null|string
655
     */
656
    public function getComments()
657
    {
658
        return $this->comments;
659
    }
660
661
    /**
662
     * @param null|string $comments
663
     * @return ProductInterface
664
     */
665
    public function setComments($comments)
666
    {
667
        $this->comments = $comments;
668
        return $this;
669
    }
670
671
    /**
672
     * @return float|null
673
     */
674
    public function getCostPrice()
675
    {
676
        return $this->costPrice;
677
    }
678
679
    /**
680
     * @param float|null $costPrice
681
     * @return ProductInterface
682
     */
683
    public function setCostPrice($costPrice)
684
    {
685
        $this->costPrice = $costPrice;
686
        return $this;
687
    }
688
689
    /**
690
     * @return \DateTimeImmutable|null
691
     */
692
    public function getCreated()
693
    {
694
        return $this->created;
695
    }
696
697
    /**
698
     * @param \DateTimeImmutable|null $created
699
     * @return ProductInterface
700
     */
701
    public function setCreated($created)
702
    {
703
        $this->created = $created;
704
        return $this;
705
    }
706
707
    /**
708
     * @return null|string
709
     */
710
    public function getCreatedBy()
711
    {
712
        return $this->createdBy;
713
    }
714
715
    /**
716
     * @param null|string $createdBy
717
     * @return ProductInterface
718
     */
719
    public function setCreatedBy($createdBy)
720
    {
721
        $this->createdBy = $createdBy;
722
        return $this;
723
    }
724
725
    /**
726
     * @return int|null
727
     */
728
    public function getDefaultCategoryId()
729
    {
730
        return $this->defaultCategoryId;
731
    }
732
733
    /**
734
     * @param int|null $defaultCategoryId
735
     * @return ProductInterface
736
     */
737
    public function setDefaultCategoryId($defaultCategoryId)
738
    {
739
        $this->defaultCategoryId = $defaultCategoryId;
740
        return $this;
741
    }
742
743
    /**
744
     * @return array|null
745
     */
746
    public function getDisabledVariantIdList()
747
    {
748
        return $this->disabledVariantIdList;
749
    }
750
751
    /**
752
     * @param array|null $disabledVariantIdList
753
     * @return ProductInterface
754
     */
755
    public function setDisabledVariantIdList($disabledVariantIdList)
756
    {
757
        $this->disabledVariantIdList = $disabledVariantIdList;
758
        return $this;
759
    }
760
761
    /**
762
     * @return null|string
763
     */
764
    public function getEdbPriserProductNumber()
765
    {
766
        return $this->edbPriserProductNumber;
767
    }
768
769
    /**
770
     * @param null|string $edbPriserProductNumber
771
     * @return ProductInterface
772
     */
773
    public function setEdbPriserProductNumber($edbPriserProductNumber)
774
    {
775
        $this->edbPriserProductNumber = $edbPriserProductNumber;
776
        return $this;
777
    }
778
779
    /**
780
     * @return null|string
781
     */
782
    public function getFileSaleLink()
783
    {
784
        return $this->fileSaleLink;
785
    }
786
787
    /**
788
     * @param null|string $fileSaleLink
789
     * @return ProductInterface
790
     */
791
    public function setFileSaleLink($fileSaleLink)
792
    {
793
        $this->fileSaleLink = $fileSaleLink;
794
        return $this;
795
    }
796
797
    /**
798
     * @return null|string
799
     */
800
    public function getGoogleFeedCategory()
801
    {
802
        return $this->googleFeedCategory;
803
    }
804
805
    /**
806
     * @param null|string $googleFeedCategory
807
     * @return ProductInterface
808
     */
809
    public function setGoogleFeedCategory($googleFeedCategory)
810
    {
811
        $this->googleFeedCategory = $googleFeedCategory;
812
        return $this;
813
    }
814
815
    /**
816
     * @return bool|null
817
     */
818
    public function getIsGiftCertificate()
819
    {
820
        return $this->isGiftCertificate;
821
    }
822
823
    /**
824
     * @param bool|null $isGiftCertificate
825
     * @return ProductInterface
826
     */
827
    public function setIsGiftCertificate($isGiftCertificate)
828
    {
829
        $this->isGiftCertificate = $isGiftCertificate;
830
        return $this;
831
    }
832
833
    /**
834
     * @return bool|null
835
     */
836
    public function getIsModified()
837
    {
838
        return $this->isModified;
839
    }
840
841
    /**
842
     * @param bool|null $isModified
843
     * @return ProductInterface
844
     */
845
    public function setIsModified($isModified)
846
    {
847
        $this->isModified = $isModified;
848
        return $this;
849
    }
850
851
    /**
852
     * @return bool|null
853
     */
854
    public function getIsRateVariants()
855
    {
856
        return $this->isRateVariants;
857
    }
858
859
    /**
860
     * @param bool|null $isRateVariants
861
     * @return ProductInterface
862
     */
863
    public function setIsRateVariants($isRateVariants)
864
    {
865
        $this->isRateVariants = $isRateVariants;
866
        return $this;
867
    }
868
869
    /**
870
     * @return bool|null
871
     */
872
    public function getIsReviewVariants()
873
    {
874
        return $this->isReviewVariants;
875
    }
876
877
    /**
878
     * @param bool|null $isReviewVariants
879
     * @return ProductInterface
880
     */
881
    public function setIsReviewVariants($isReviewVariants)
882
    {
883
        $this->isReviewVariants = $isReviewVariants;
884
        return $this;
885
    }
886
887
    /**
888
     * @return bool|null
889
     */
890
    public function getIsVariantMaster()
891
    {
892
        return $this->isVariantMaster;
893
    }
894
895
    /**
896
     * @param bool|null $isVariantMaster
897
     * @return ProductInterface
898
     */
899
    public function setIsVariantMaster($isVariantMaster)
900
    {
901
        $this->isVariantMaster = $isVariantMaster;
902
        return $this;
903
    }
904
905
    /**
906
     * @return null|string
907
     */
908
    public function getLocationNumber()
909
    {
910
        return $this->locationNumber;
911
    }
912
913
    /**
914
     * @param null|string $locationNumber
915
     * @return ProductInterface
916
     */
917
    public function setLocationNumber($locationNumber)
918
    {
919
        $this->locationNumber = $locationNumber;
920
        return $this;
921
    }
922
923
    /**
924
     * @return array|null
925
     */
926
    public function getManufacturereIdList()
927
    {
928
        return $this->manufacturereIdList;
929
    }
930
931
    /**
932
     * @param array|null $manufacturereIdList
933
     * @return ProductInterface
934
     */
935
    public function setManufacturereIdList($manufacturereIdList)
936
    {
937
        $this->manufacturereIdList = $manufacturereIdList;
938
        return $this;
939
    }
940
941
    /**
942
     * @return int|null
943
     */
944
    public function getMaxBuyAmount()
945
    {
946
        return $this->maxBuyAmount;
947
    }
948
949
    /**
950
     * @param int|null $maxBuyAmount
951
     * @return ProductInterface
952
     */
953
    public function setMaxBuyAmount($maxBuyAmount)
954
    {
955
        $this->maxBuyAmount = $maxBuyAmount;
956
        return $this;
957
    }
958
959
    /**
960
     * @return int|null
961
     */
962
    public function getMinBuyAmount()
963
    {
964
        return $this->minBuyAmount;
965
    }
966
967
    /**
968
     * @param int|null $minBuyAmount
969
     * @return ProductInterface
970
     */
971
    public function setMinBuyAmount($minBuyAmount)
972
    {
973
        $this->minBuyAmount = $minBuyAmount;
974
        return $this;
975
    }
976
977
    /**
978
     * @return int|null
979
     */
980
    public function getMinBuyAmountB2B()
981
    {
982
        return $this->minBuyAmountB2B;
983
    }
984
985
    /**
986
     * @param int|null $minBuyAmountB2B
987
     * @return ProductInterface
988
     */
989
    public function setMinBuyAmountB2B($minBuyAmountB2B)
990
    {
991
        $this->minBuyAmountB2B = $minBuyAmountB2B;
992
        return $this;
993
    }
994
995
    /**
996
     * @return string
997
     */
998
    public function getNumber()
999
    {
1000
        return (string)$this->number;
1001
    }
1002
1003
    /**
1004
     * @param string $number
1005
     * @return ProductInterface
1006
     */
1007
    public function setNumber(string $number)
1008
    {
1009
        $this->number = $number;
1010
        return $this;
1011
    }
1012
1013
    /**
1014
     * @return null|string
1015
     */
1016
    public function getPicture()
1017
    {
1018
        return $this->picture;
1019
    }
1020
1021
    /**
1022
     * @param null|string $picture
1023
     * @return ProductInterface
1024
     */
1025
    public function setPicture($picture)
1026
    {
1027
        $this->picture = $picture;
1028
        return $this;
1029
    }
1030
1031
    /**
1032
     * @return int|null
1033
     */
1034
    public function getSalesCount()
1035
    {
1036
        return $this->salesCount;
1037
    }
1038
1039
    /**
1040
     * @param int|null $salesCount
1041
     * @return ProductInterface
1042
     */
1043
    public function setSalesCount($salesCount)
1044
    {
1045
        $this->salesCount = $salesCount;
1046
        return $this;
1047
    }
1048
1049
    /**
1050
     * @return array|null
1051
     */
1052
    public function getSegmentIdList()
1053
    {
1054
        return $this->segmentIdList;
1055
    }
1056
1057
    /**
1058
     * @param array|null $segmentIdList
1059
     * @return ProductInterface
1060
     */
1061
    public function setSegmentIdList($segmentIdList)
1062
    {
1063
        $this->segmentIdList = $segmentIdList;
1064
        return $this;
1065
    }
1066
1067
    /**
1068
     * @return int|null
1069
     */
1070
    public function getSortOrder()
1071
    {
1072
        return $this->sortOrder;
1073
    }
1074
1075
    /**
1076
     * @param int|null $sortOrder
1077
     * @return ProductInterface
1078
     */
1079
    public function setSortOrder($sortOrder)
1080
    {
1081
        $this->sortOrder = $sortOrder;
1082
        return $this;
1083
    }
1084
1085
    /**
1086
     * @return int|null
1087
     */
1088
    public function getStockCount()
1089
    {
1090
        return $this->stockCount;
1091
    }
1092
1093
    /**
1094
     * @param int|null $stockCount
1095
     * @return ProductInterface
1096
     */
1097
    public function setStockCount($stockCount)
1098
    {
1099
        $this->stockCount = $stockCount;
1100
        return $this;
1101
    }
1102
1103
    /**
1104
     * @return int|null
1105
     */
1106
    public function getStockLimit()
1107
    {
1108
        return $this->stockLimit;
1109
    }
1110
1111
    /**
1112
     * @param int|null $stockLimit
1113
     * @return ProductInterface
1114
     */
1115
    public function setStockLimit($stockLimit)
1116
    {
1117
        $this->stockLimit = $stockLimit;
1118
        return $this;
1119
    }
1120
1121
    /**
1122
     * @return int|null
1123
     */
1124
    public function getTypeId()
1125
    {
1126
        return $this->typeId;
1127
    }
1128
1129
    /**
1130
     * @param int|null $typeId
1131
     * @return ProductInterface
1132
     */
1133
    public function setTypeId($typeId)
1134
    {
1135
        $this->typeId = $typeId;
1136
        return $this;
1137
    }
1138
1139
    /**
1140
     * @return \DateTimeImmutable|null
1141
     */
1142
    public function getUpdated()
1143
    {
1144
        return $this->updated;
1145
    }
1146
1147
    /**
1148
     * @param \DateTimeImmutable|null $updated
1149
     * @return ProductInterface
1150
     */
1151
    public function setUpdated($updated)
1152
    {
1153
        $this->updated = $updated;
1154
        return $this;
1155
    }
1156
1157
    /**
1158
     * @return null|string
1159
     */
1160
    public function getUpdatedBy()
1161
    {
1162
        return $this->updatedBy;
1163
    }
1164
1165
    /**
1166
     * @param null|string $updatedBy
1167
     * @return ProductInterface
1168
     */
1169
    public function setUpdatedBy($updatedBy)
1170
    {
1171
        $this->updatedBy = $updatedBy;
1172
        return $this;
1173
    }
1174
1175
    /**
1176
     * @return array|null
1177
     */
1178
    public function getVariantGroupIdList()
1179
    {
1180
        return $this->variantGroupIdList;
1181
    }
1182
1183
    /**
1184
     * @param array|null $variantGroupIdList
1185
     * @return ProductInterface
1186
     */
1187
    public function setVariantGroupIdList($variantGroupIdList)
1188
    {
1189
        $this->variantGroupIdList = $variantGroupIdList;
1190
        return $this;
1191
    }
1192
1193
    /**
1194
     * @return array|null
1195
     */
1196
    public function getVariantIdList()
1197
    {
1198
        return $this->variantIdList;
1199
    }
1200
1201
    /**
1202
     * @param array|null $variantIdList
1203
     * @return ProductInterface
1204
     */
1205
    public function setVariantIdList($variantIdList)
1206
    {
1207
        $this->variantIdList = $variantIdList;
1208
        return $this;
1209
    }
1210
1211
    /**
1212
     * @return int|null
1213
     */
1214
    public function getVariantMasterId()
1215
    {
1216
        return $this->variantMasterId;
1217
    }
1218
1219
    /**
1220
     * @param int|null $variantMasterId
1221
     * @return ProductInterface
1222
     */
1223
    public function setVariantMasterId($variantMasterId)
1224
    {
1225
        $this->variantMasterId = $variantMasterId;
1226
        return $this;
1227
    }
1228
1229
    /**
1230
     * @return null|string
1231
     */
1232
    public function getVendorNumber()
1233
    {
1234
        return $this->vendorNumber;
1235
    }
1236
1237
    /**
1238
     * @param null|string $vendorNumber
1239
     * @return ProductInterface
1240
     */
1241
    public function setVendorNumber($vendorNumber)
1242
    {
1243
        $this->vendorNumber = $vendorNumber;
1244
        return $this;
1245
    }
1246
1247
    /**
1248
     * @return int|null
1249
     */
1250
    public function getWeight()
1251
    {
1252
        return $this->weight;
1253
    }
1254
1255
    /**
1256
     * @param int|null $weight
1257
     * @return ProductInterface
1258
     */
1259
    public function setWeight($weight)
1260
    {
1261
        $this->weight = $weight;
1262
        return $this;
1263
    }
1264
1265
    /**
1266
     * @return ArrayCollection|Category[]
1267
     */
1268
    public function getCategories()
1269
    {
1270
        return $this->categories;
1271
    }
1272
1273
    /**
1274
     * @param ArrayCollection|Category[] $categories
1275
     * @return ProductInterface
1276
     */
1277
    public function setCategories($categories)
1278
    {
1279
        $this->categories = $categories;
1280
        return $this;
1281
    }
1282
1283
    /**
1284
     * @return ArrayCollection|Variant[]
1285
     */
1286
    public function getDisabledVariants()
1287
    {
1288
        return $this->disabledVariants;
1289
    }
1290
1291
    /**
1292
     * @param ArrayCollection|Variant[] $disabledVariants
1293
     * @return ProductInterface
1294
     */
1295
    public function setDisabledVariants($disabledVariants)
1296
    {
1297
        $this->disabledVariants = $disabledVariants;
1298
        return $this;
1299
    }
1300
1301
    /**
1302
     * @return ArrayCollection|Manufacturer[]
1303
     */
1304
    public function getManufacturers()
1305
    {
1306
        return $this->manufacturers;
1307
    }
1308
1309
    /**
1310
     * @param ArrayCollection|Manufacturer[] $manufacturers
1311
     * @return ProductInterface
1312
     */
1313
    public function setManufacturers($manufacturers)
1314
    {
1315
        $this->manufacturers = $manufacturers;
1316
        return $this;
1317
    }
1318
1319
    /**
1320
     * @return ArrayCollection|Medium[]
1321
     */
1322
    public function getMedia()
1323
    {
1324
        return $this->media;
1325
    }
1326
1327
    /**
1328
     * @param ArrayCollection|Medium[] $media
1329
     * @return ProductInterface
1330
     */
1331
    public function setMedia($media)
1332
    {
1333
        $this->media = $media;
1334
        return $this;
1335
    }
1336
1337
    /**
1338
     * @return ArrayCollection|Price[]
1339
     */
1340
    public function getPrices()
1341
    {
1342
        return $this->prices;
1343
    }
1344
1345
    /**
1346
     * @param ArrayCollection|Price[] $prices
1347
     * @return ProductInterface
1348
     */
1349
    public function setPrices($prices)
1350
    {
1351
        $this->prices = $prices;
1352
        return $this;
1353
    }
1354
1355
    /**
1356
     * @return ArrayCollection|ProductRelation[]
1357
     */
1358
    public function getProductRelations()
1359
    {
1360
        return $this->productRelations;
1361
    }
1362
1363
    /**
1364
     * @param ArrayCollection|ProductRelation[] $productRelations
1365
     * @return ProductInterface
1366
     */
1367
    public function setProductRelations($productRelations)
1368
    {
1369
        $this->productRelations = $productRelations;
1370
        return $this;
1371
    }
1372
1373
    /**
1374
     * @return ProductTypeInterface
1375
     */
1376
    public function getProductType(): ProductTypeInterface
1377
    {
1378
        return $this->productType;
1379
    }
1380
1381
    /**
1382
     * @param ProductType $productType
1383
     * @return ProductInterface
1384
     */
1385
    public function setProductType(ProductType $productType)
1386
    {
1387
        $this->productType = $productType;
1388
        return $this;
1389
    }
1390
1391
    /**
1392
     * @return ArrayCollection|Segment[]
1393
     */
1394
    public function getSegments()
1395
    {
1396
        return $this->segments;
1397
    }
1398
1399
    /**
1400
     * @param ArrayCollection|Segment[] $segments
1401
     * @return ProductInterface
1402
     */
1403
    public function setSegments($segments)
1404
    {
1405
        $this->segments = $segments;
1406
        return $this;
1407
    }
1408
1409
    /**
1410
     * @return ArrayCollection|VariantGroup[]
1411
     */
1412
    public function getVariantGroups()
1413
    {
1414
        return $this->variantGroups;
1415
    }
1416
1417
    /**
1418
     * @param ArrayCollection|VariantGroup[] $variantGroups
1419
     * @return ProductInterface
1420
     */
1421
    public function setVariantGroups($variantGroups)
1422
    {
1423
        $this->variantGroups = $variantGroups;
1424
        return $this;
1425
    }
1426
1427
    /**
1428
     * @return ArrayCollection|Variant[]
1429
     */
1430
    public function getVariants()
1431
    {
1432
        return $this->variants;
1433
    }
1434
1435
    /**
1436
     * @param ArrayCollection|Variant[] $variants
1437
     * @return ProductInterface
1438
     */
1439
    public function setVariants($variants)
1440
    {
1441
        $this->variants = $variants;
1442
        return $this;
1443
    }
1444
1445
    /**
1446
     * @return Product|null
1447
     */
1448
    public function getParent(): ?Product
1449
    {
1450
        return $this->parent;
1451
    }
1452
1453
    /**
1454
     * @param Product|null $parent
1455
     * @return Product
1456
     */
1457
    public function setParent(?Product $parent)
1458
    {
1459
        $this->parent = $parent;
1460
        return $this;
1461
    }
1462
1463
    /**
1464
     * @return ArrayCollection|Product[]
1465
     */
1466
    public function getChildren()
1467
    {
1468
        return $this->children;
1469
    }
1470
1471
    /**
1472
     * @param ArrayCollection|Product[] $children
1473
     * @return Product
1474
     */
1475
    public function setChildren($children)
1476
    {
1477
        $this->children = $children;
1478
        return $this;
1479
    }
1480
}
1481