Failed Conditions
Pull Request — experimental/sf (#29)
by Kentaro
50:12 queued 39:05
created

Product::getPrice02Max()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\Entity;
15
16
use Doctrine\Common\Collections\ArrayCollection;
17
use Doctrine\ORM\Mapping as ORM;
18
19
/**
20
 * Product
21
 *
22
 * @ORM\Table(name="dtb_product")
23
 * @ORM\InheritanceType("SINGLE_TABLE")
24
 * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
25
 * @ORM\HasLifecycleCallbacks()
26
 * @ORM\Entity(repositoryClass="Eccube\Repository\ProductRepository")
27
 */
28
class Product extends \Eccube\Entity\AbstractEntity
29
{
30
    private $_calc = false;
31
    private $stockFinds = [];
32
    private $stocks = [];
33
    private $stockUnlimiteds = [];
34
    private $price01 = [];
35
    private $price02 = [];
36
    private $price01IncTaxs = [];
37
    private $price02IncTaxs = [];
38
    private $codes = [];
39
    private $classCategories1 = [];
40
    private $classCategories2 = [];
41
    private $className1;
42
    private $className2;
43
44
    /**
45
     * @return string
46
     */
47
    public function __toString()
48
    {
49
        return (string) $this->getName();
50
    }
51
52 48
    public function _calc()
53
    {
54 48
        if (!$this->_calc) {
55 48
            $i = 0;
56 48
            foreach ($this->getProductClasses() as $ProductClass) {
57
                /* @var $ProductClass \Eccube\Entity\ProductClass */
58
                // stock_find
59 48
                if ($ProductClass->isVisible() == false) {
60 48
                    continue;
61
                }
62 48
                $ClassCategory1 = $ProductClass->getClassCategory1();
63 48
                $ClassCategory2 = $ProductClass->getClassCategory2();
64 48
                if ($ClassCategory1 && !$ClassCategory1->isVisible()) {
65
                    continue;
66
                }
67 48
                if ($ClassCategory2 && !$ClassCategory2->isVisible()) {
68
                    continue;
69
                }
70
71
                // stock_find
72 48
                $this->stockFinds[] = $ProductClass->getStockFind();
73
74
                // stock
75 48
                $this->stocks[] = $ProductClass->getStock();
76
77
                // stock_unlimited
78 48
                $this->stockUnlimiteds[] = $ProductClass->isStockUnlimited();
79
80
                // price01
81 48
                if (!is_null($ProductClass->getPrice01())) {
82 7
                    $this->price01[] = $ProductClass->getPrice01();
83
                    // price01IncTax
84 7
                    $this->price01IncTaxs[] = $ProductClass->getPrice01IncTax();
85
                }
86
87
                // price02
88 48
                $this->price02[] = $ProductClass->getPrice02();
89
90
                // price02IncTax
91 48
                $this->price02IncTaxs[] = $ProductClass->getPrice02IncTax();
92
93
                // product_code
94 48
                $this->codes[] = $ProductClass->getCode();
95
96 48
                if ($i === 0) {
97 48
                    if ($ProductClass->getClassCategory1() && $ProductClass->getClassCategory1()->getId()) {
98 48
                        $this->className1 = $ProductClass->getClassCategory1()->getClassName()->getName();
99
                    }
100 48
                    if ($ProductClass->getClassCategory2() && $ProductClass->getClassCategory2()->getId()) {
101 30
                        $this->className2 = $ProductClass->getClassCategory2()->getClassName()->getName();
102
                    }
103
                }
104 48
                if ($ProductClass->getClassCategory1()) {
105 48
                    $classCategoryId1 = $ProductClass->getClassCategory1()->getId();
106 48
                    if (!empty($classCategoryId1)) {
107 48
                        $this->classCategories1[$ProductClass->getClassCategory1()->getId()] = $ProductClass->getClassCategory1()->getName();
108 48
                        if ($ProductClass->getClassCategory2()) {
109 30
                            $this->classCategories2[$ProductClass->getClassCategory1()->getId()][$ProductClass->getClassCategory2()->getId()] = $ProductClass->getClassCategory2()->getName();
110
                        }
111
                    }
112
                }
113 48
                $i++;
114
            }
115 48
            $this->_calc = true;
116
        }
117
    }
118
119
    /**
120
     * Is Enable
121
     *
122
     * @return bool
123
     */
124 80
    public function isEnable()
125
    {
126 80
        return $this->getStatus()->getId() === \Eccube\Entity\Master\ProductStatus::DISPLAY_SHOW ? true : false;
127
    }
128
129
    /**
130
     * Get ClassName1
131
     *
132
     * @return string
133
     */
134 45
    public function getClassName1()
135
    {
136 45
        $this->_calc();
137
138 45
        return $this->className1;
139
    }
140
141
    /**
142
     * Get ClassName2
143
     *
144
     * @return string
145
     */
146 45
    public function getClassName2()
147
    {
148 45
        $this->_calc();
149
150 45
        return $this->className2;
151
    }
152
153
    /**
154
     * Get getClassCategories1
155
     *
156
     * @return array
157
     */
158 45
    public function getClassCategories1()
159
    {
160 45
        $this->_calc();
161
162 45
        return $this->classCategories1;
163
    }
164
165 45
    public function getClassCategories1AsFlip()
166
    {
167 45
        return array_flip($this->getClassCategories1());
168
    }
169
170
    /**
171
     * Get getClassCategories2
172
     *
173
     * @return array
174
     */
175 4
    public function getClassCategories2($class_category1)
176
    {
177 4
        $this->_calc();
178
179 4
        return isset($this->classCategories2[$class_category1]) ? $this->classCategories2[$class_category1] : [];
180
    }
181
182 4
    public function getClassCategories2AsFlip($class_category1)
183
    {
184 4
        return array_flip($this->getClassCategories2($class_category1));
185
    }
186
187
    /**
188
     * Get StockFind
189
     *
190
     * @return bool
191
     */
192 46
    public function getStockFind()
193
    {
194 46
        $this->_calc();
195
196 46
        return max($this->stockFinds);
197
    }
198
199
    /**
200
     * Get Stock min
201
     *
202
     * @return integer
203
     */
204
    public function getStockMin()
205
    {
206
        $this->_calc();
207
208
        return min($this->stocks);
209
    }
210
211
    /**
212
     * Get Stock max
213
     *
214
     * @return integer
215
     */
216
    public function getStockMax()
217
    {
218
        $this->_calc();
219
220
        return max($this->stocks);
221
    }
222
223
    /**
224
     * Get StockUnlimited min
225
     *
226
     * @return integer
227
     */
228
    public function getStockUnlimitedMin()
229
    {
230
        $this->_calc();
231
232
        return min($this->stockUnlimiteds);
233
    }
234
235
    /**
236
     * Get StockUnlimited max
237
     *
238
     * @return integer
239
     */
240
    public function getStockUnlimitedMax()
241
    {
242
        $this->_calc();
243
244
        return max($this->stockUnlimiteds);
245
    }
246
247
    /**
248
     * Get Price01 min
249
     *
250
     * @return integer
251
     */
252 11 View Code Duplication
    public function getPrice01Min()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
253
    {
254 11
        $this->_calc();
255
256 11
        if (count($this->price01) == 0) {
257 9
            return null;
258
        }
259
260 2
        return min($this->price01);
261
    }
262
263
    /**
264
     * Get Price01 max
265
     *
266
     * @return integer
267
     */
268 2 View Code Duplication
    public function getPrice01Max()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
269
    {
270 2
        $this->_calc();
271
272 2
        if (count($this->price01) == 0) {
273
            return null;
274
        }
275
276 2
        return max($this->price01);
277
    }
278
279
    /**
280
     * Get Price02 min
281
     *
282
     * @return integer
283
     */
284 3
    public function getPrice02Min()
285
    {
286 3
        $this->_calc();
287
288 3
        return min($this->price02);
289
    }
290
291
    /**
292
     * Get Price02 max
293
     *
294
     * @return integer
295
     */
296 3
    public function getPrice02Max()
297
    {
298 3
        $this->_calc();
299
300 3
        return max($this->price02);
301
    }
302
303
    /**
304
     * Get Price01IncTax min
305
     *
306
     * @return integer
307
     */
308 2
    public function getPrice01IncTaxMin()
309
    {
310 2
        $this->_calc();
311
312 2
        return min($this->price01IncTaxs);
313
    }
314
315
    /**
316
     * Get Price01IncTax max
317
     *
318
     * @return integer
319
     */
320 2
    public function getPrice01IncTaxMax()
321
    {
322 2
        $this->_calc();
323
324 2
        return max($this->price01IncTaxs);
325
    }
326
327
    /**
328
     * Get Price02IncTax min
329
     *
330
     * @return integer
331
     */
332 14
    public function getPrice02IncTaxMin()
333
    {
334 14
        $this->_calc();
335
336 14
        return min($this->price02IncTaxs);
337
    }
338
339
    /**
340
     * Get Price02IncTax max
341
     *
342
     * @return integer
343
     */
344 14
    public function getPrice02IncTaxMax()
345
    {
346 14
        $this->_calc();
347
348 14
        return max($this->price02IncTaxs);
349
    }
350
351
    /**
352
     * Get Product_code min
353
     *
354
     * @return integer
355
     */
356 13 View Code Duplication
    public function getCodeMin()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
357
    {
358 13
        $this->_calc();
359
360 13
        $codes = [];
361 13
        foreach ($this->codes as $code) {
362 13
            if (!is_null($code)) {
363 13
                $codes[] = $code;
364
            }
365
        }
366
367 13
        return count($codes) ? min($codes) : null;
368
    }
369
370
    /**
371
     * Get Product_code max
372
     *
373
     * @return integer
374
     */
375 13 View Code Duplication
    public function getCodeMax()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
376
    {
377 13
        $this->_calc();
378
379 13
        $codes = [];
380 13
        foreach ($this->codes as $code) {
381 13
            if (!is_null($code)) {
382 13
                $codes[] = $code;
383
            }
384
        }
385
386 13
        return count($codes) ? max($codes) : null;
387
    }
388
389 62
    public function getMainListImage()
390
    {
391 62
        $ProductImages = $this->getProductImage();
392
393 62
        return empty($ProductImages) ? null : $ProductImages[0];
394
    }
395
396 1
    public function getMainFileName()
397
    {
398 1
        if (count($this->ProductImage) > 0) {
399 1
            return $this->ProductImage[0];
400
        } else {
401
            return null;
402
        }
403
    }
404
405 43
    public function hasProductClass()
406
    {
407 43
        foreach ($this->ProductClasses as $ProductClass) {
408 43
            if (!$ProductClass->isVisible()) {
409 4
                continue;
410
            }
411 43
            if (!is_null($ProductClass->getClassCategory1())) {
412 43
                return true;
413
            }
414
        }
415
416 18
        return false;
417
    }
418
419
    /**
420
     * @var integer
421
     *
422
     * @ORM\Column(name="id", type="integer", options={"unsigned":true})
423
     * @ORM\Id
424
     * @ORM\GeneratedValue(strategy="IDENTITY")
425
     */
426
    private $id;
427
428
    /**
429
     * @var string
430
     *
431
     * @ORM\Column(name="name", type="string", length=255)
432
     */
433
    private $name;
434
435
    /**
436
     * @var string|null
437
     *
438
     * @ORM\Column(name="note", type="string", length=4000, nullable=true)
439
     */
440
    private $note;
441
442
    /**
443
     * @var string|null
444
     *
445
     * @ORM\Column(name="description_list", type="string", length=4000, nullable=true)
446
     */
447
    private $description_list;
448
449
    /**
450
     * @var string|null
451
     *
452
     * @ORM\Column(name="description_detail", type="string", length=4000, nullable=true)
453
     */
454
    private $description_detail;
455
456
    /**
457
     * @var string|null
458
     *
459
     * @ORM\Column(name="search_word", type="string", length=4000, nullable=true)
460
     */
461
    private $search_word;
462
463
    /**
464
     * @var string|null
465
     *
466
     * @ORM\Column(name="free_area", type="text", nullable=true)
467
     */
468
    private $free_area;
469
470
    /**
471
     * @var \DateTime
472
     *
473
     * @ORM\Column(name="create_date", type="datetimetz")
474
     */
475
    private $create_date;
476
477
    /**
478
     * @var \DateTime
479
     *
480
     * @ORM\Column(name="update_date", type="datetimetz")
481
     */
482
    private $update_date;
483
484
    /**
485
     * @var \Doctrine\Common\Collections\Collection
486
     *
487
     * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductCategory", mappedBy="Product", cascade={"persist","remove"})
488
     */
489
    private $ProductCategories;
490
491
    /**
492
     * @var \Doctrine\Common\Collections\Collection
493
     *
494
     * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductClass", mappedBy="Product", cascade={"persist","remove"})
495
     */
496
    private $ProductClasses;
497
498
    /**
499
     * @var \Doctrine\Common\Collections\Collection
500
     *
501
     * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductImage", mappedBy="Product", cascade={"remove"})
502
     * @ORM\OrderBy({
503
     *     "sort_no"="ASC"
504
     * })
505
     */
506
    private $ProductImage;
507
508
    /**
509
     * @var \Doctrine\Common\Collections\Collection
510
     *
511
     * @ORM\OneToMany(targetEntity="Eccube\Entity\ProductTag", mappedBy="Product")
512
     */
513
    private $ProductTag;
514
515
    /**
516
     * @var \Doctrine\Common\Collections\Collection
517
     *
518
     * @ORM\OneToMany(targetEntity="Eccube\Entity\CustomerFavoriteProduct", mappedBy="Product")
519
     */
520
    private $CustomerFavoriteProducts;
521
522
    /**
523
     * @var \Eccube\Entity\Member
524
     *
525
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
526
     * @ORM\JoinColumns({
527
     *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
528
     * })
529
     */
530
    private $Creator;
531
532
    /**
533
     * @var \Eccube\Entity\Master\ProductStatus
534
     *
535
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\ProductStatus")
536
     * @ORM\JoinColumns({
537
     *   @ORM\JoinColumn(name="product_status_id", referencedColumnName="id")
538
     * })
539
     */
540
    private $Status;
541
542
    /**
543
     * Constructor
544
     */
545 367
    public function __construct()
546
    {
547 367
        $this->ProductCategories = new \Doctrine\Common\Collections\ArrayCollection();
548 367
        $this->ProductClasses = new \Doctrine\Common\Collections\ArrayCollection();
549 367
        $this->ProductImage = new \Doctrine\Common\Collections\ArrayCollection();
550 367
        $this->ProductTag = new \Doctrine\Common\Collections\ArrayCollection();
551 367
        $this->CustomerFavoriteProducts = new \Doctrine\Common\Collections\ArrayCollection();
552
    }
553
554 1
    public function __clone()
555
    {
556 1
        $this->id = null;
557
    }
558
559 1
    public function copy()
560
    {
561
        // コピー対象外
562 1
        $this->CustomerFavoriteProducts = new ArrayCollection();
563
564 1
        $Categories = $this->getProductCategories();
565 1
        $this->ProductCategories = new ArrayCollection();
566 1
        foreach ($Categories as $Category) {
567 1
            $CopyCategory = clone $Category;
568 1
            $this->addProductCategory($CopyCategory);
569 1
            $CopyCategory->setProduct($this);
570
        }
571
572 1
        $Classes = $this->getProductClasses();
573 1
        $this->ProductClasses = new ArrayCollection();
574 1
        foreach ($Classes as $Class) {
575 1
            $CopyClass = clone $Class;
576 1
            $this->addProductClass($CopyClass);
577 1
            $CopyClass->setProduct($this);
578
        }
579
580 1
        $Images = $this->getProductImage();
581 1
        $this->ProductImage = new ArrayCollection();
582 1
        foreach ($Images as $Image) {
583 1
            $CloneImage = clone $Image;
584 1
            $this->addProductImage($CloneImage);
585 1
            $CloneImage->setProduct($this);
586
        }
587
588 1
        $Tags = $this->getProductTag();
589 1
        $this->ProductTag = new ArrayCollection();
590 1
        foreach ($Tags as $Tag) {
591
            $CloneTag = clone $Tag;
592
            $this->addProductTag($CloneTag);
593
            $CloneTag->setProduct($this);
594
        }
595
596 1
        return $this;
597
    }
598
599
    /**
600
     * Get id.
601
     *
602
     * @return int
603
     */
604 376
    public function getId()
605
    {
606 376
        return $this->id;
607
    }
608
609
    /**
610
     * Set name.
611
     *
612
     * @param string $name
613
     *
614
     * @return Product
615
     */
616 367
    public function setName($name)
617
    {
618 367
        $this->name = $name;
619
620 367
        return $this;
621
    }
622
623
    /**
624
     * Get name.
625
     *
626
     * @return string
627
     */
628 282
    public function getName()
629
    {
630 282
        return $this->name;
631
    }
632
633
    /**
634
     * Set note.
635
     *
636
     * @param string|null $note
637
     *
638
     * @return Product
639
     */
640 25
    public function setNote($note = null)
641
    {
642 25
        $this->note = $note;
643
644 25
        return $this;
645
    }
646
647
    /**
648
     * Get note.
649
     *
650
     * @return string|null
651
     */
652 18
    public function getNote()
653
    {
654 18
        return $this->note;
655
    }
656
657
    /**
658
     * Set descriptionList.
659
     *
660
     * @param string|null $descriptionList
661
     *
662
     * @return Product
663
     */
664 364
    public function setDescriptionList($descriptionList = null)
665
    {
666 364
        $this->description_list = $descriptionList;
667
668 364
        return $this;
669
    }
670
671
    /**
672
     * Get descriptionList.
673
     *
674
     * @return string|null
675
     */
676 20
    public function getDescriptionList()
677
    {
678 20
        return $this->description_list;
679
    }
680
681
    /**
682
     * Set descriptionDetail.
683
     *
684
     * @param string|null $descriptionDetail
685
     *
686
     * @return Product
687
     */
688 364
    public function setDescriptionDetail($descriptionDetail = null)
689
    {
690 364
        $this->description_detail = $descriptionDetail;
691
692 364
        return $this;
693
    }
694
695
    /**
696
     * Get descriptionDetail.
697
     *
698
     * @return string|null
699
     */
700 29
    public function getDescriptionDetail()
701
    {
702 29
        return $this->description_detail;
703
    }
704
705
    /**
706
     * Set searchWord.
707
     *
708
     * @param string|null $searchWord
709
     *
710
     * @return Product
711
     */
712 23
    public function setSearchWord($searchWord = null)
713
    {
714 23
        $this->search_word = $searchWord;
715
716 23
        return $this;
717
    }
718
719
    /**
720
     * Get searchWord.
721
     *
722
     * @return string|null
723
     */
724 18
    public function getSearchWord()
725
    {
726 18
        return $this->search_word;
727
    }
728
729
    /**
730
     * Set freeArea.
731
     *
732
     * @param string|null $freeArea
733
     *
734
     * @return Product
735
     */
736 25
    public function setFreeArea($freeArea = null)
737
    {
738 25
        $this->free_area = $freeArea;
739
740 25
        return $this;
741
    }
742
743
    /**
744
     * Get freeArea.
745
     *
746
     * @return string|null
747
     */
748 29
    public function getFreeArea()
749
    {
750 29
        return $this->free_area;
751
    }
752
753
    /**
754
     * Set createDate.
755
     *
756
     * @param \DateTime $createDate
757
     *
758
     * @return Product
759
     */
760 366
    public function setCreateDate($createDate)
761
    {
762 366
        $this->create_date = $createDate;
763
764 366
        return $this;
765
    }
766
767
    /**
768
     * Get createDate.
769
     *
770
     * @return \DateTime
771
     */
772 8
    public function getCreateDate()
773
    {
774 8
        return $this->create_date;
775
    }
776
777
    /**
778
     * Set updateDate.
779
     *
780
     * @param \DateTime $updateDate
781
     *
782
     * @return Product
783
     */
784 367
    public function setUpdateDate($updateDate)
785
    {
786 367
        $this->update_date = $updateDate;
787
788 367
        return $this;
789
    }
790
791
    /**
792
     * Get updateDate.
793
     *
794
     * @return \DateTime
795
     */
796 7
    public function getUpdateDate()
797
    {
798 7
        return $this->update_date;
799
    }
800
801
    /**
802
     * Add productCategory.
803
     *
804
     * @param \Eccube\Entity\ProductCategory $productCategory
805
     *
806
     * @return Product
807
     */
808 356
    public function addProductCategory(\Eccube\Entity\ProductCategory $productCategory)
809
    {
810 356
        $this->ProductCategories[] = $productCategory;
811
812 356
        return $this;
813
    }
814
815
    /**
816
     * Remove productCategory.
817
     *
818
     * @param \Eccube\Entity\ProductCategory $productCategory
819
     *
820
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
821
     */
822 12
    public function removeProductCategory(\Eccube\Entity\ProductCategory $productCategory)
823
    {
824 12
        return $this->ProductCategories->removeElement($productCategory);
825
    }
826
827
    /**
828
     * Get productCategories.
829
     *
830
     * @return \Doctrine\Common\Collections\Collection
831
     */
832 38
    public function getProductCategories()
833
    {
834 38
        return $this->ProductCategories;
835
    }
836
837
    /**
838
     * Add productClass.
839
     *
840
     * @param \Eccube\Entity\ProductClass $productClass
841
     *
842
     * @return Product
843
     */
844 367
    public function addProductClass(\Eccube\Entity\ProductClass $productClass)
845
    {
846 367
        $this->ProductClasses[] = $productClass;
847
848 367
        return $this;
849
    }
850
851
    /**
852
     * Remove productClass.
853
     *
854
     * @param \Eccube\Entity\ProductClass $productClass
855
     *
856
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
857
     */
858
    public function removeProductClass(\Eccube\Entity\ProductClass $productClass)
859
    {
860
        return $this->ProductClasses->removeElement($productClass);
861
    }
862
863
    /**
864
     * Get productClasses.
865
     *
866
     * @return \Doctrine\Common\Collections\Collection
867
     */
868 333
    public function getProductClasses()
869
    {
870 333
        return $this->ProductClasses;
871
    }
872
873
    /**
874
     * Add productImage.
875
     *
876
     * @param \Eccube\Entity\ProductImage $productImage
877
     *
878
     * @return Product
879
     */
880 356
    public function addProductImage(\Eccube\Entity\ProductImage $productImage)
881
    {
882 356
        $this->ProductImage[] = $productImage;
883
884 356
        return $this;
885
    }
886
887
    /**
888
     * Remove productImage.
889
     *
890
     * @param \Eccube\Entity\ProductImage $productImage
891
     *
892
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
893
     */
894 2
    public function removeProductImage(\Eccube\Entity\ProductImage $productImage)
895
    {
896 2
        return $this->ProductImage->removeElement($productImage);
897
    }
898
899
    /**
900
     * Get productImage.
901
     *
902
     * @return \Doctrine\Common\Collections\Collection
903
     */
904 95
    public function getProductImage()
905
    {
906 95
        return $this->ProductImage;
907
    }
908
909
    /**
910
     * Add productTag.
911
     *
912
     * @param \Eccube\Entity\ProductTag $productTag
913
     *
914
     * @return Product
915
     */
916 18
    public function addProductTag(\Eccube\Entity\ProductTag $productTag)
917
    {
918 18
        $this->ProductTag[] = $productTag;
919
920 18
        return $this;
921
    }
922
923
    /**
924
     * Remove productTag.
925
     *
926
     * @param \Eccube\Entity\ProductTag $productTag
927
     *
928
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
929
     */
930 2
    public function removeProductTag(\Eccube\Entity\ProductTag $productTag)
931
    {
932 2
        return $this->ProductTag->removeElement($productTag);
933
    }
934
935
    /**
936
     * Get productTag.
937
     *
938
     * @return \Doctrine\Common\Collections\Collection
939
     */
940 40
    public function getProductTag()
941
    {
942 40
        return $this->ProductTag;
943
    }
944
945
    /**
946
     * Get Tag
947
     * フロント側タグsort_no順の配列を作成する
948
     *
949
     * @return []Tag
0 ignored issues
show
Documentation introduced by
The doc-type []Tag could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
950
     */
951 31
    public function getTags()
952
    {
953 31
        $tags = [];
954
955 31
        foreach ($this->getProductTag() as $productTag) {
956 1
            $tags[] = $productTag->getTag();
957
        }
958
959 31
        usort($tags, function (Tag $tag1, Tag $tag2) {
960
            return $tag1->getSortNo() < $tag2->getSortNo();
961 31
        });
962
963 31
        return $tags;
964
    }
965
966
    /**
967
     * Add customerFavoriteProduct.
968
     *
969
     * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
970
     *
971
     * @return Product
972
     */
973
    public function addCustomerFavoriteProduct(\Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct)
974
    {
975
        $this->CustomerFavoriteProducts[] = $customerFavoriteProduct;
976
977
        return $this;
978
    }
979
980
    /**
981
     * Remove customerFavoriteProduct.
982
     *
983
     * @param \Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct
984
     *
985
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
986
     */
987
    public function removeCustomerFavoriteProduct(\Eccube\Entity\CustomerFavoriteProduct $customerFavoriteProduct)
988
    {
989
        return $this->CustomerFavoriteProducts->removeElement($customerFavoriteProduct);
990
    }
991
992
    /**
993
     * Get customerFavoriteProducts.
994
     *
995
     * @return \Doctrine\Common\Collections\Collection
996
     */
997
    public function getCustomerFavoriteProducts()
998
    {
999
        return $this->CustomerFavoriteProducts;
1000
    }
1001
1002
    /**
1003
     * Set creator.
1004
     *
1005
     * @param \Eccube\Entity\Member|null $creator
1006
     *
1007
     * @return Product
1008
     */
1009 366
    public function setCreator(\Eccube\Entity\Member $creator = null)
1010
    {
1011 366
        $this->Creator = $creator;
1012
1013 366
        return $this;
1014
    }
1015
1016
    /**
1017
     * Get creator.
1018
     *
1019
     * @return \Eccube\Entity\Member|null
1020
     */
1021 12
    public function getCreator()
1022
    {
1023 12
        return $this->Creator;
1024
    }
1025
1026
    /**
1027
     * Set status.
1028
     *
1029
     * @param \Eccube\Entity\Master\ProductStatus|null $status
1030
     *
1031
     * @return Product
1032
     */
1033 364
    public function setStatus(\Eccube\Entity\Master\ProductStatus $status = null)
1034
    {
1035 364
        $this->Status = $status;
1036
1037 364
        return $this;
1038
    }
1039
1040
    /**
1041
     * Get status.
1042
     *
1043
     * @return \Eccube\Entity\Master\ProductStatus|null
1044
     */
1045 106
    public function getStatus()
1046
    {
1047 106
        return $this->Status;
1048
    }
1049
}
1050