Completed
Push — 4.0 ( 268f2c...88f012 )
by Hideki
05:48 queued 10s
created

src/Eccube/Entity/ProductClass.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.ec-cube.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\ORM\Mapping as ORM;
17
18 1
if (!class_exists('\Eccube\Entity\ProductClass')) {
19
    /**
20
     * ProductClass
21
     *
22
     * @ORM\Table(name="dtb_product_class", indexes={@ORM\Index(name="dtb_product_class_price02_idx", columns={"price02"}), @ORM\Index(name="dtb_product_class_stock_stock_unlimited_idx", columns={"stock", "stock_unlimited"})})
23
     * @ORM\InheritanceType("SINGLE_TABLE")
24
     * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
25
     * @ORM\HasLifecycleCallbacks()
26
     * @ORM\Entity(repositoryClass="Eccube\Repository\ProductClassRepository")
27
     */
28
    class ProductClass extends \Eccube\Entity\AbstractEntity
29
    {
30
        private $price01_inc_tax = null;
31
        private $price02_inc_tax = null;
32
        private $tax_rate = false;
33
34
        /**
35
         * 商品規格名を含めた商品名を返す.
36
         *
37
         * @return string
38
         */
39
        public function formattedProductName()
40
        {
41
            $productName = $this->getProduct()->getName();
42
            if ($this->hasClassCategory1()) {
43
                $productName .= ' - '.$this->getClassCategory1()->getName();
44
            }
45
            if ($this->hasClassCategory2()) {
46
                $productName .= ' - '.$this->getClassCategory2()->getName();
47
            }
48
49
            return $productName;
50
        }
51
52
        /**
53
         * Is Enable
54
         *
55
         * @return bool
56
         *
57 80
         * @deprecated
58
         */
59 80
        public function isEnable()
60
        {
61
            return $this->getProduct()->isEnable();
62
        }
63
64
        /**
65
         * Set price01 IncTax
66
         *
67
         * @param  string       $price01_inc_tax
68
         *
69 463
         * @return ProductClass
70
         */
71 463
        public function setPrice01IncTax($price01_inc_tax)
72
        {
73 463
            $this->price01_inc_tax = $price01_inc_tax;
74
75
            return $this;
76
        }
77
78
        /**
79
         * Get price01 IncTax
80
         *
81 8
         * @return string
82
         */
83 8
        public function getPrice01IncTax()
84
        {
85
            return $this->price01_inc_tax;
86
        }
87
88
        /**
89
         * Set price02 IncTax
90
         *
91
         *
92 463
         * @return ProductClass
93
         */
94 463
        public function setPrice02IncTax($price02_inc_tax)
95
        {
96 463
            $this->price02_inc_tax = $price02_inc_tax;
97
98
            return $this;
99
        }
100
101
        /**
102
         * Get price02 IncTax
103
         *
104 102
         * @return string
105
         */
106 102
        public function getPrice02IncTax()
107
        {
108
            return $this->price02_inc_tax;
109
        }
110
111
        /**
112
         * Get StockFind
113
         *
114 49
         * @return bool
115
         */
116 49
        public function getStockFind()
117 49
        {
118
            if ($this->getStock() > 0 || $this->isStockUnlimited()) {
119 3
                return true;
120
            } else {
121
                return false;
122
            }
123
        }
124
125
        /**
126
         * Set tax_rate
127
         *
128
         * @param  string $tax_rate
129
         *
130 41
         * @return ProductClass
131
         */
132 41
        public function setTaxRate($tax_rate)
133
        {
134 41
            $this->tax_rate = $tax_rate;
0 ignored issues
show
Documentation Bug introduced by
The property $tax_rate was declared of type boolean, but $tax_rate is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
135
136
            return $this;
137
        }
138
139
        /**
140
         * Get tax_rate
141
         *
142 46
         * @return boolean
143
         */
144 46
        public function getTaxRate()
145
        {
146
            return $this->tax_rate;
147
        }
148
149
        /**
150
         * Has ClassCategory1
151
         *
152 198
         * @return boolean
153
         */
154 198
        public function hasClassCategory1()
155
        {
156
            return isset($this->ClassCategory1);
157
        }
158
159
        /**
160
         * Has ClassCategory1
161
         *
162 198
         * @return boolean
163
         */
164 198
        public function hasClassCategory2()
165
        {
166
            return isset($this->ClassCategory2);
167
        }
168
169
        /**
170
         * @var int
171
         *
172
         * @ORM\Column(name="id", type="integer", options={"unsigned":true})
173
         * @ORM\Id
174
         * @ORM\GeneratedValue(strategy="IDENTITY")
175
         */
176
        private $id;
177
178
        /**
179
         * @var string|null
180
         *
181
         * @ORM\Column(name="product_code", type="string", length=255, nullable=true)
182
         */
183
        private $code;
184
185
        /**
186
         * @var string|null
187
         *
188
         * @ORM\Column(name="stock", type="decimal", precision=10, scale=0, nullable=true)
189
         */
190
        private $stock;
191
192
        /**
193
         * @var boolean
194
         *
195
         * @ORM\Column(name="stock_unlimited", type="boolean", options={"default":false})
196
         */
197
        private $stock_unlimited = false;
198
199
        /**
200
         * @var string|null
201
         *
202
         * @ORM\Column(name="sale_limit", type="decimal", precision=10, scale=0, nullable=true, options={"unsigned":true})
203
         */
204
        private $sale_limit;
205
206
        /**
207
         * @var string|null
208
         *
209
         * @ORM\Column(name="price01", type="decimal", precision=12, scale=2, nullable=true)
210
         */
211
        private $price01;
212
213
        /**
214
         * @var string
215
         *
216
         * @ORM\Column(name="price02", type="decimal", precision=12, scale=2)
217
         */
218
        private $price02;
219
220
        /**
221
         * @var string|null
222
         *
223
         * @ORM\Column(name="delivery_fee", type="decimal", precision=12, scale=2, nullable=true, options={"unsigned":true})
224
         */
225
        private $delivery_fee;
226
227
        /**
228
         * @var boolean
229
         *
230
         * @ORM\Column(name="visible", type="boolean", options={"default":true})
231
         */
232
        private $visible;
233
234
        /**
235
         * @var \DateTime
236
         *
237
         * @ORM\Column(name="create_date", type="datetimetz")
238
         */
239
        private $create_date;
240
241
        /**
242
         * @var \DateTime
243
         *
244
         * @ORM\Column(name="update_date", type="datetimetz")
245
         */
246
        private $update_date;
247
248
        /**
249
         * @var string|null
250
         *
251
         * @ORM\Column(name="currency_code", type="string", nullable=true)
252
         */
253
        private $currency_code;
254
255
        /**
256
         * @var string
257
         *
258
         * @ORM\Column(name="point_rate", type="decimal", precision=10, scale=0, options={"unsigned":true}, nullable=true)
259
         */
260
        private $point_rate;
261
262
        /**
263
         * @var \Eccube\Entity\ProductStock
264
         *
265
         * @ORM\OneToOne(targetEntity="Eccube\Entity\ProductStock", mappedBy="ProductClass", cascade={"persist","remove"})
266
         */
267
        private $ProductStock;
268
269
        /**
270
         * @var \Eccube\Entity\TaxRule
271
         *
272
         * @ORM\OneToOne(targetEntity="Eccube\Entity\TaxRule", mappedBy="ProductClass", cascade={"persist","remove"})
273
         */
274
        private $TaxRule;
275
276
        /**
277
         * @var \Eccube\Entity\Product
278
         *
279
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Product", inversedBy="ProductClasses")
280
         * @ORM\JoinColumns({
281
         *   @ORM\JoinColumn(name="product_id", referencedColumnName="id")
282
         * })
283
         */
284
        private $Product;
285
286
        /**
287
         * @var \Eccube\Entity\Master\SaleType
288
         *
289
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\SaleType")
290
         * @ORM\JoinColumns({
291
         *   @ORM\JoinColumn(name="sale_type_id", referencedColumnName="id")
292
         * })
293
         */
294
        private $SaleType;
295
296
        /**
297
         * @var \Eccube\Entity\ClassCategory
298
         *
299
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\ClassCategory")
300
         * @ORM\JoinColumns({
301
         *   @ORM\JoinColumn(name="class_category_id1", referencedColumnName="id", nullable=true)
302
         * })
303
         */
304
        private $ClassCategory1;
305
306
        /**
307
         * @var \Eccube\Entity\ClassCategory
308
         *
309
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\ClassCategory")
310
         * @ORM\JoinColumns({
311
         *   @ORM\JoinColumn(name="class_category_id2", referencedColumnName="id", nullable=true)
312
         * })
313
         */
314
        private $ClassCategory2;
315
316
        /**
317
         * @var \Eccube\Entity\DeliveryDuration
318
         *
319
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\DeliveryDuration")
320
         * @ORM\JoinColumns({
321
         *   @ORM\JoinColumn(name="delivery_duration_id", referencedColumnName="id")
322
         * })
323
         */
324
        private $DeliveryDuration;
325
326
        /**
327
         * @var \Eccube\Entity\Member
328
         *
329
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
330
         * @ORM\JoinColumns({
331
         *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
332
         * })
333
         */
334 3
        private $Creator;
335
336 3
        public function __clone()
337
        {
338
            $this->id = null;
339
        }
340
341
        /**
342
         * Get id.
343
         *
344 434
         * @return int
345
         */
346 434
        public function getId()
347
        {
348
            return $this->id;
349
        }
350
351
        /**
352
         * Set code.
353
         *
354
         * @param string|null $code
355
         *
356 406
         * @return ProductClass
357
         */
358 406
        public function setCode($code = null)
359
        {
360 406
            $this->code = $code;
361
362
            return $this;
363
        }
364
365
        /**
366
         * Get code.
367
         *
368 300
         * @return string|null
369
         */
370 300
        public function getCode()
371
        {
372
            return $this->code;
373
        }
374
375
        /**
376
         * Set stock.
377
         *
378
         * @param string|null $stock
379
         *
380 427
         * @return ProductClass
381
         */
382 427
        public function setStock($stock = null)
383
        {
384 427
            $this->stock = $stock;
385
386
            return $this;
387
        }
388
389
        /**
390
         * Get stock.
391
         *
392 278
         * @return string|null
393
         */
394 278
        public function getStock()
395
        {
396
            return $this->stock;
397
        }
398
399
        /**
400
         * Set stockUnlimited.
401
         *
402
         * @param boolean $stockUnlimited
403
         *
404 409
         * @return ProductClass
405
         */
406 409
        public function setStockUnlimited($stockUnlimited)
407
        {
408 409
            $this->stock_unlimited = $stockUnlimited;
409
410
            return $this;
411
        }
412
413
        /**
414
         * Get stockUnlimited.
415
         *
416 310
         * @return boolean
417
         */
418 310
        public function isStockUnlimited()
419
        {
420
            return $this->stock_unlimited;
421
        }
422
423
        /**
424
         * Set saleLimit.
425
         *
426
         * @param string|null $saleLimit
427
         *
428 33
         * @return ProductClass
429
         */
430 33
        public function setSaleLimit($saleLimit = null)
431
        {
432 33
            $this->sale_limit = $saleLimit;
433
434
            return $this;
435
        }
436
437
        /**
438
         * Get saleLimit.
439
         *
440 126
         * @return string|null
441
         */
442 126
        public function getSaleLimit()
443
        {
444
            return $this->sale_limit;
445
        }
446
447
        /**
448
         * Set price01.
449
         *
450
         * @param string|null $price01
451
         *
452 44
         * @return ProductClass
453
         */
454 44
        public function setPrice01($price01 = null)
455
        {
456 44
            $this->price01 = $price01;
457
458
            return $this;
459
        }
460
461
        /**
462
         * Get price01.
463
         *
464 481
         * @return string|null
465
         */
466 481
        public function getPrice01()
467
        {
468
            return $this->price01;
469
        }
470
471
        /**
472
         * Set price02.
473
         *
474
         * @param string $price02
475
         *
476 429
         * @return ProductClass
477
         */
478 429
        public function setPrice02($price02)
479
        {
480 429
            $this->price02 = $price02;
481
482
            return $this;
483
        }
484
485
        /**
486
         * Get price02.
487
         *
488 481
         * @return string
489
         */
490 481
        public function getPrice02()
491
        {
492
            return $this->price02;
493
        }
494
495
        /**
496
         * Set deliveryFee.
497
         *
498
         * @param string|null $deliveryFee
499
         *
500 25
         * @return ProductClass
501
         */
502 25
        public function setDeliveryFee($deliveryFee = null)
503
        {
504 25
            $this->delivery_fee = $deliveryFee;
505
506
            return $this;
507
        }
508
509
        /**
510
         * Get deliveryFee.
511
         *
512 45
         * @return string|null
513
         */
514 45
        public function getDeliveryFee()
515
        {
516
            return $this->delivery_fee;
517
        }
518
519
        /**
520 231
         * @return boolean
521
         */
522 231
        public function isVisible()
523
        {
524
            return $this->visible;
525
        }
526
527
        /**
528
         * @param boolean $visible
529
         *
530 414
         * @return ProductClass
531
         */
532 414
        public function setVisible($visible)
533
        {
534 414
            $this->visible = $visible;
535
536
            return $this;
537
        }
538
539
        /**
540
         * Set createDate.
541
         *
542
         * @param \DateTime $createDate
543
         *
544 408
         * @return ProductClass
545
         */
546 408
        public function setCreateDate($createDate)
547
        {
548 408
            $this->create_date = $createDate;
549
550
            return $this;
551
        }
552
553
        /**
554
         * Get createDate.
555
         *
556
         * @return \DateTime
557
         */
558
        public function getCreateDate()
559
        {
560
            return $this->create_date;
561
        }
562
563
        /**
564
         * Set updateDate.
565
         *
566
         * @param \DateTime $updateDate
567
         *
568 412
         * @return ProductClass
569
         */
570 412
        public function setUpdateDate($updateDate)
571
        {
572 412
            $this->update_date = $updateDate;
573
574
            return $this;
575
        }
576
577
        /**
578
         * Get updateDate.
579
         *
580
         * @return \DateTime
581
         */
582
        public function getUpdateDate()
583
        {
584
            return $this->update_date;
585
        }
586
587
        /**
588
         * Get currencyCode.
589
         *
590
         * @return string
591
         */
592
        public function getCurrencyCode()
593
        {
594
            return $this->currency_code;
595
        }
596
597
        /**
598
         * Set currencyCode.
599
         *
600
         * @param string|null $currencyCode
601
         *
602 408
         * @return $this
603
         */
604 408
        public function setCurrencyCode($currencyCode = null)
605
        {
606 408
            $this->currency_code = $currencyCode;
607
608
            return $this;
609
        }
610
611
        /**
612
         * Set productStock.
613
         *
614
         * @param \Eccube\Entity\ProductStock|null $productStock
615
         *
616 409
         * @return ProductClass
617
         */
618 409
        public function setProductStock(\Eccube\Entity\ProductStock $productStock = null)
619
        {
620 409
            $this->ProductStock = $productStock;
621
622
            return $this;
623
        }
624
625
        /**
626
         * Get productStock.
627
         *
628 35
         * @return \Eccube\Entity\ProductStock|null
629
         */
630 35
        public function getProductStock()
631
        {
632
            return $this->ProductStock;
633
        }
634
635
        /**
636
         * Set taxRule.
637
         *
638
         * @param \Eccube\Entity\TaxRule|null $taxRule
639
         *
640 10
         * @return ProductClass
641
         */
642 10
        public function setTaxRule(\Eccube\Entity\TaxRule $taxRule = null)
643
        {
644 10
            $this->TaxRule = $taxRule;
645
646
            return $this;
647
        }
648
649
        /**
650
         * Get taxRule.
651
         *
652 22
         * @return \Eccube\Entity\TaxRule|null
653
         */
654 22
        public function getTaxRule()
655
        {
656
            return $this->TaxRule;
657
        }
658
659
        /**
660
         * Set product.
661
         *
662
         * @param \Eccube\Entity\Product|null $product
663
         *
664 413
         * @return ProductClass
665
         */
666 413
        public function setProduct(\Eccube\Entity\Product $product = null)
667
        {
668 413
            $this->Product = $product;
669
670
            return $this;
671
        }
672
673
        /**
674
         * Get product.
675
         *
676 463
         * @return \Eccube\Entity\Product|null
677
         */
678 463
        public function getProduct()
679
        {
680
            return $this->Product;
681
        }
682
683
        /**
684
         * Set saleType.
685
         *
686
         * @param \Eccube\Entity\Master\SaleType|null $saleType
687
         *
688 408
         * @return ProductClass
689
         */
690 408
        public function setSaleType(\Eccube\Entity\Master\SaleType $saleType = null)
691
        {
692 408
            $this->SaleType = $saleType;
693
694
            return $this;
695
        }
696
697
        /**
698
         * Get saleType.
699
         *
700 149
         * @return \Eccube\Entity\Master\SaleType|null
701
         */
702 149
        public function getSaleType()
703
        {
704
            return $this->SaleType;
705
        }
706
707
        /**
708
         * Set classCategory1.
709
         *
710
         * @param \Eccube\Entity\ClassCategory|null $classCategory1
711
         *
712 411
         * @return ProductClass
713
         */
714 411
        public function setClassCategory1(\Eccube\Entity\ClassCategory $classCategory1 = null)
715
        {
716 411
            $this->ClassCategory1 = $classCategory1;
717
718
            return $this;
719
        }
720
721
        /**
722
         * Get classCategory1.
723
         *
724 324
         * @return \Eccube\Entity\ClassCategory|null
725
         */
726 324
        public function getClassCategory1()
727
        {
728
            return $this->ClassCategory1;
729
        }
730
731
        /**
732
         * Set classCategory2.
733
         *
734
         * @param \Eccube\Entity\ClassCategory|null $classCategory2
735
         *
736 285
         * @return ProductClass
737
         */
738 285
        public function setClassCategory2(\Eccube\Entity\ClassCategory $classCategory2 = null)
739
        {
740 285
            $this->ClassCategory2 = $classCategory2;
741
742
            return $this;
743
        }
744
745
        /**
746
         * Get classCategory2.
747
         *
748 272
         * @return \Eccube\Entity\ClassCategory|null
749
         */
750 272
        public function getClassCategory2()
751
        {
752
            return $this->ClassCategory2;
753
        }
754
755
        /**
756
         * Set deliveryDuration.
757
         *
758
         * @param \Eccube\Entity\DeliveryDuration|null $deliveryDuration
759
         *
760 397
         * @return ProductClass
761
         */
762 397
        public function setDeliveryDuration(\Eccube\Entity\DeliveryDuration $deliveryDuration = null)
763
        {
764 397
            $this->DeliveryDuration = $deliveryDuration;
765
766
            return $this;
767
        }
768
769
        /**
770
         * Get deliveryDuration.
771
         *
772 96
         * @return \Eccube\Entity\DeliveryDuration|null
773
         */
774 96
        public function getDeliveryDuration()
775
        {
776
            return $this->DeliveryDuration;
777
        }
778
779
        /**
780
         * Set creator.
781
         *
782
         * @param \Eccube\Entity\Member|null $creator
783
         *
784 412
         * @return ProductClass
785
         */
786 412
        public function setCreator(\Eccube\Entity\Member $creator = null)
787
        {
788 412
            $this->Creator = $creator;
789
790
            return $this;
791
        }
792
793
        /**
794
         * Get creator.
795
         *
796
         * @return \Eccube\Entity\Member|null
797
         */
798
        public function getCreator()
799
        {
800
            return $this->Creator;
801
        }
802
803
        /**
804
         * Set pointRate
805
         *
806
         * @param string $pointRate
807
         *
808
         * @return ProductClass
809
         */
810
        public function setPointRate($pointRate)
811
        {
812
            $this->point_rate = $pointRate;
813
814
            return $this;
815
        }
816
817
        /**
818
         * Get pointRate
819
         *
820
         * @return string
821
         */
822
        public function getPointRate()
823
        {
824
            return $this->point_rate;
825
        }
826
    }
827
}
828