Failed Conditions
Pull Request — experimental/sf (#3236)
by Kentaro
49:41 queued 37:58
created

Shipping::setTrackingNumber()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
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\ORM\Mapping as ORM;
17
use Eccube\Entity\Master\ShippingStatus;
18
use Eccube\Service\Calculator\OrderItemCollection;
19
use Eccube\Service\PurchaseFlow\ItemCollection;
20
21
/**
22
 * Shipping
23
 *
24
 * @ORM\Table(name="dtb_shipping")
25
 * @ORM\InheritanceType("SINGLE_TABLE")
26
 * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
27
 * @ORM\HasLifecycleCallbacks()
28
 * @ORM\Entity(repositoryClass="Eccube\Repository\ShippingRepository")
29
 */
30
class Shipping extends \Eccube\Entity\AbstractEntity
31
{
32 26
    public function getShippingMultipleDefaultName()
33
    {
34 26
        return $this->getName01().' '.$this->getPref()->getName().' '.$this->getAddr01().' '.$this->getAddr02();
35
    }
36
37
    /**
38
     * @var int
39
     *
40
     * @ORM\Column(name="id", type="integer", options={"unsigned":true})
41
     * @ORM\Id
42
     * @ORM\GeneratedValue(strategy="IDENTITY")
43
     */
44
    private $id;
45
46
    /**
47
     * @var string
48
     *
49
     * @ORM\Column(name="name01", type="string", length=255)
50
     */
51
    private $name01;
52
53
    /**
54
     * @var string
55
     *
56
     * @ORM\Column(name="name02", type="string", length=255)
57
     */
58
    private $name02;
59
60
    /**
61
     * @var string
62
     *
63
     * @ORM\Column(name="kana01", type="string", length=255)
64
     */
65
    private $kana01;
66
67
    /**
68
     * @var string
69
     *
70
     * @ORM\Column(name="kana02", type="string", length=255)
71
     */
72
    private $kana02;
73
74
    /**
75
     * @var string|null
76
     *
77
     * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
78
     */
79
    private $company_name;
80
81
    /**
82
     * @var string|null
83
     *
84
     * @ORM\Column(name="tel01", type="string", length=5, nullable=true)
85
     */
86
    private $tel01;
87
88
    /**
89
     * @var string|null
90
     *
91
     * @ORM\Column(name="tel02", type="string", length=4, nullable=true)
92
     */
93
    private $tel02;
94
95
    /**
96
     * @var string|null
97
     *
98
     * @ORM\Column(name="tel03", type="string", length=4, nullable=true)
99
     */
100
    private $tel03;
101
102
    /**
103
     * @var string|null
104
     *
105
     * @ORM\Column(name="fax01", type="string", length=5, nullable=true)
106
     */
107
    private $fax01;
108
109
    /**
110
     * @var string|null
111
     *
112
     * @ORM\Column(name="fax02", type="string", length=4, nullable=true)
113
     */
114
    private $fax02;
115
116
    /**
117
     * @var string|null
118
     *
119
     * @ORM\Column(name="fax03", type="string", length=4, nullable=true)
120
     */
121
    private $fax03;
122
123
    /**
124
     * @var string|null
125
     *
126
     * @ORM\Column(name="zip01", type="string", length=3, nullable=true)
127
     */
128
    private $zip01;
129
130
    /**
131
     * @var string|null
132
     *
133
     * @ORM\Column(name="zip02", type="string", length=4, nullable=true)
134
     */
135
    private $zip02;
136
137
    /**
138
     * @var string|null
139
     *
140
     * @ORM\Column(name="zipcode", type="string", length=7, nullable=true)
141
     */
142
    private $zipcode;
143
144
    /**
145
     * @var string|null
146
     *
147
     * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
148
     */
149
    private $addr01;
150
151
    /**
152
     * @var string|null
153
     *
154
     * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
155
     */
156
    private $addr02;
157
158
    /**
159
     * @var string|null
160
     *
161
     * @ORM\Column(name="delivery_name", type="string", length=255, nullable=true)
162
     */
163
    private $shipping_delivery_name;
164
165
    /**
166
     * @var int
167
     *
168
     * @ORM\Column(name="time_id", type="integer", options={"unsigned":true}, nullable=true)
169
     */
170
    private $time_id;
171
172
    /**
173
     * @var int
174
     *
175
     * @ORM\Column(name="fee_id", type="integer", options={"unsigned":true}, nullable=true)
176
     */
177
    private $fee_id;
178
179
    /**
180
     * @var string|null
181
     *
182
     * @ORM\Column(name="delivery_time", type="string", length=255, nullable=true)
183
     */
184
    private $shipping_delivery_time;
185
186
    /**
187
     * お届け予定日/お届け希望日
188
     *
189
     * @var \DateTime|null
190
     *
191
     * @ORM\Column(name="delivery_date", type="datetimetz", nullable=true)
192
     */
193
    private $shipping_delivery_date;
194
195
    /**
196
     * @var string|null
197
     *
198
     * @ORM\Column(name="delivery_fee", type="decimal", precision=12, scale=2, nullable=true, options={"unsigned":true,"default":0})
199
     */
200
    private $shipping_delivery_fee = 0;
201
202
    /**
203
     * 出荷日
204
     *
205
     * @var \DateTime|null
206
     *
207
     * @ORM\Column(name="shipping_date", type="datetimetz", nullable=true)
208
     */
209
    private $shipping_date;
210
211
    /**
212
     * @var string
213
     *
214
     * @ORM\Column(name="tracking_number", type="string", length=255, nullable=true)
215
     */
216
    private $tracking_number;
217
218
    /**
219
     * @var string
220
     *
221
     * @ORM\Column(name="note", type="string", length=4000, nullable=true)
222
     */
223
    private $note;
224
225
    /**
226
     * @var int|null
227
     *
228
     * @ORM\Column(name="sort_no", type="smallint", nullable=true, options={"unsigned":true})
229
     */
230
    private $sort_no;
231
232
    /**
233
     * @var \DateTime
234
     *
235
     * @ORM\Column(name="create_date", type="datetimetz")
236
     */
237
    private $create_date;
238
239
    /**
240
     * @var \DateTime
241
     *
242
     * @ORM\Column(name="update_date", type="datetimetz")
243
     */
244
    private $update_date;
245
246
    /**
247
     * @var \Doctrine\Common\Collections\Collection
248
     *
249
     * @ORM\OneToMany(targetEntity="Eccube\Entity\OrderItem", mappedBy="Shipping", cascade={"persist"})
250
     */
251
    private $OrderItems;
252
253
    /**
254
     * @var \Eccube\Entity\Master\Country
255
     *
256
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
257
     * @ORM\JoinColumns({
258
     *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
259
     * })
260
     */
261
    private $Country;
262
263
    /**
264
     * @var \Eccube\Entity\Master\Pref
265
     *
266
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
267
     * @ORM\JoinColumns({
268
     *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
269
     * })
270
     */
271
    private $Pref;
272
273
    /**
274
     * @var \Eccube\Entity\Delivery
275
     *
276
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Delivery")
277
     * @ORM\JoinColumns({
278
     *   @ORM\JoinColumn(name="delivery_id", referencedColumnName="id")
279
     * })
280
     */
281
    private $Delivery;
282
283
    /**
284
     * @var \Doctrine\Common\Collections\Collection
285
     */
286
    private $Orders;
0 ignored issues
show
Unused Code introduced by
The property $Orders is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
287
288
    /**
289
     * @var \Eccube\Entity\ProductClass
290
     */
291
    private $ProductClassOfTemp;
292
293
    /**
294
     * @var \Eccube\Entity\Master\ShippingStatus
295
     *
296
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\ShippingStatus")
297
     * @ORM\JoinColumns({
298
     *   @ORM\JoinColumn(name="shipping_status_id", referencedColumnName="id")
299
     * })
300
     */
301
    private $ShippingStatus;
302
303
    /**
304
     * @var \Eccube\Entity\Member
305
     *
306
     * @ORM\ManyToOne(targetEntity="Eccube\Entity\Member")
307
     * @ORM\JoinColumns({
308
     *   @ORM\JoinColumn(name="creator_id", referencedColumnName="id")
309
     * })
310
     */
311
    private $Creator;
312
313
    /**
314
     * Constructor
315
     */
316 198
    public function __construct()
317
    {
318 198
        $this->OrderItems = new \Doctrine\Common\Collections\ArrayCollection();
319
    }
320
321
    /**
322
     * CustomerAddress から個人情報を設定.
323
     *
324
     * @param \Eccube\Entity\CustomerAddress $CustomerAddress
325
     *
326
     * @return \Eccube\Entity\Shipping
327
     */
328 25 View Code Duplication
    public function setFromCustomerAddress(CustomerAddress $CustomerAddress)
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...
329
    {
330
        $this
331 25
            ->setName01($CustomerAddress->getName01())
332 25
            ->setName02($CustomerAddress->getName02())
333 25
            ->setKana01($CustomerAddress->getKana01())
334 25
            ->setKana02($CustomerAddress->getKana02())
335 25
            ->setCompanyName($CustomerAddress->getCompanyName())
336 25
            ->setTel01($CustomerAddress->getTel01())
337 25
            ->setTel02($CustomerAddress->getTel02())
338 25
            ->setTel03($CustomerAddress->getTel03())
339 25
            ->setFax01($CustomerAddress->getFax01())
340 25
            ->setFax02($CustomerAddress->getFax02())
341 25
            ->setFax03($CustomerAddress->getFax03())
342 25
            ->setZip01($CustomerAddress->getZip01())
343 25
            ->setZip02($CustomerAddress->getZip02())
344 25
            ->setZipCode($CustomerAddress->getZip01().$CustomerAddress->getZip02())
345 25
            ->setPref($CustomerAddress->getPref())
346 25
            ->setAddr01($CustomerAddress->getAddr01())
347 25
            ->setAddr02($CustomerAddress->getAddr02());
348
349 25
        return $this;
350
    }
351
352
    /**
353
     * 個人情報をクリア.
354
     *
355
     * @return \Eccube\Entity\Shipping
356
     */
357
    public function clearCustomerAddress()
358
    {
359
        $this
360
            ->setName01(null)
361
            ->setName02(null)
362
            ->setKana01(null)
363
            ->setKana02(null)
364
            ->setCompanyName(null)
365
            ->setTel01(null)
366
            ->setTel02(null)
367
            ->setTel03(null)
368
            ->setFax01(null)
369
            ->setFax02(null)
370
            ->setFax03(null)
371
            ->setZip01(null)
372
            ->setZip02(null)
373
            ->setZipCode(null)
374
            ->setPref(null)
375
            ->setAddr01(null)
376
            ->setAddr02(null);
377
378
        return $this;
379
    }
380
381
    /**
382
     * Get id.
383
     *
384
     * @return int
385
     */
386 79
    public function getId()
387
    {
388 79
        return $this->id;
389
    }
390
391
    /**
392
     * Set name01.
393
     *
394
     * @param string $name01
395
     *
396
     * @return Shipping
397
     */
398 66
    public function setName01($name01)
399
    {
400 66
        $this->name01 = $name01;
401
402 66
        return $this;
403
    }
404
405
    /**
406
     * Get name01.
407
     *
408
     * @return string
409
     */
410 66
    public function getName01()
411
    {
412 66
        return $this->name01;
413
    }
414
415
    /**
416
     * Set name02.
417
     *
418
     * @param string $name02
419
     *
420
     * @return Shipping
421
     */
422 54
    public function setName02($name02)
423
    {
424 54
        $this->name02 = $name02;
425
426 54
        return $this;
427
    }
428
429
    /**
430
     * Get name02.
431
     *
432
     * @return string
433
     */
434 64
    public function getName02()
435
    {
436 64
        return $this->name02;
437
    }
438
439
    /**
440
     * Set kana01.
441
     *
442
     * @param string $kana01
443
     *
444
     * @return Shipping
445
     */
446 54
    public function setKana01($kana01)
447
    {
448 54
        $this->kana01 = $kana01;
449
450 54
        return $this;
451
    }
452
453
    /**
454
     * Get kana01.
455
     *
456
     * @return string
457
     */
458 61
    public function getKana01()
459
    {
460 61
        return $this->kana01;
461
    }
462
463
    /**
464
     * Set kana02.
465
     *
466
     * @param string $kana02
467
     *
468
     * @return Shipping
469
     */
470 52
    public function setKana02($kana02)
471
    {
472 52
        $this->kana02 = $kana02;
473
474 52
        return $this;
475
    }
476
477
    /**
478
     * Get kana02.
479
     *
480
     * @return string
481
     */
482 60
    public function getKana02()
483
    {
484 60
        return $this->kana02;
485
    }
486
487
    /**
488
     * Set companyName.
489
     *
490
     * @param string|null $companyName
491
     *
492
     * @return Shipping
493
     */
494 52
    public function setCompanyName($companyName = null)
495
    {
496 52
        $this->company_name = $companyName;
497
498 52
        return $this;
499
    }
500
501
    /**
502
     * Get companyName.
503
     *
504
     * @return string|null
505
     */
506 21
    public function getCompanyName()
507
    {
508 21
        return $this->company_name;
509
    }
510
511
    /**
512
     * Set tel01.
513
     *
514
     * @param string|null $tel01
515
     *
516
     * @return Shipping
517
     */
518 52
    public function setTel01($tel01 = null)
519
    {
520 52
        $this->tel01 = $tel01;
521
522 52
        return $this;
523
    }
524
525
    /**
526
     * Get tel01.
527
     *
528
     * @return string|null
529
     */
530 64
    public function getTel01()
531
    {
532 64
        return $this->tel01;
533
    }
534
535
    /**
536
     * Set tel02.
537
     *
538
     * @param string|null $tel02
539
     *
540
     * @return Shipping
541
     */
542 52
    public function setTel02($tel02 = null)
543
    {
544 52
        $this->tel02 = $tel02;
545
546 52
        return $this;
547
    }
548
549
    /**
550
     * Get tel02.
551
     *
552
     * @return string|null
553
     */
554 64
    public function getTel02()
555
    {
556 64
        return $this->tel02;
557
    }
558
559
    /**
560
     * Set tel03.
561
     *
562
     * @param string|null $tel03
563
     *
564
     * @return Shipping
565
     */
566 52
    public function setTel03($tel03 = null)
567
    {
568 52
        $this->tel03 = $tel03;
569
570 52
        return $this;
571
    }
572
573
    /**
574
     * Get tel03.
575
     *
576
     * @return string|null
577
     */
578 64
    public function getTel03()
579
    {
580 64
        return $this->tel03;
581
    }
582
583
    /**
584
     * Set fax01.
585
     *
586
     * @param string|null $fax01
587
     *
588
     * @return Shipping
589
     */
590 52
    public function setFax01($fax01 = null)
591
    {
592 52
        $this->fax01 = $fax01;
593
594 52
        return $this;
595
    }
596
597
    /**
598
     * Get fax01.
599
     *
600
     * @return string|null
601
     */
602 21
    public function getFax01()
603
    {
604 21
        return $this->fax01;
605
    }
606
607
    /**
608
     * Set fax02.
609
     *
610
     * @param string|null $fax02
611
     *
612
     * @return Shipping
613
     */
614 52
    public function setFax02($fax02 = null)
615
    {
616 52
        $this->fax02 = $fax02;
617
618 52
        return $this;
619
    }
620
621
    /**
622
     * Get fax02.
623
     *
624
     * @return string|null
625
     */
626 21
    public function getFax02()
627
    {
628 21
        return $this->fax02;
629
    }
630
631
    /**
632
     * Set fax03.
633
     *
634
     * @param string|null $fax03
635
     *
636
     * @return Shipping
637
     */
638 52
    public function setFax03($fax03 = null)
639
    {
640 52
        $this->fax03 = $fax03;
641
642 52
        return $this;
643
    }
644
645
    /**
646
     * Get fax03.
647
     *
648
     * @return string|null
649
     */
650 21
    public function getFax03()
651
    {
652 21
        return $this->fax03;
653
    }
654
655
    /**
656
     * Set zip01.
657
     *
658
     * @param string|null $zip01
659
     *
660
     * @return Shipping
661
     */
662 55
    public function setZip01($zip01 = null)
663
    {
664 55
        $this->zip01 = $zip01;
665
666 55
        return $this;
667
    }
668
669
    /**
670
     * Get zip01.
671
     *
672
     * @return string|null
673
     */
674 64
    public function getZip01()
675
    {
676 64
        return $this->zip01;
677
    }
678
679
    /**
680
     * Set zip02.
681
     *
682
     * @param string|null $zip02
683
     *
684
     * @return Shipping
685
     */
686 55
    public function setZip02($zip02 = null)
687
    {
688 55
        $this->zip02 = $zip02;
689
690 55
        return $this;
691
    }
692
693
    /**
694
     * Get zip02.
695
     *
696
     * @return string|null
697
     */
698 64
    public function getZip02()
699
    {
700 64
        return $this->zip02;
701
    }
702
703
    /**
704
     * Set zipcode.
705
     *
706
     * @param string|null $zipcode
707
     *
708
     * @return Shipping
709
     */
710 51
    public function setZipcode($zipcode = null)
711
    {
712 51
        $this->zipcode = $zipcode;
713
714 51
        return $this;
715
    }
716
717
    /**
718
     * Get zipcode.
719
     *
720
     * @return string|null
721
     */
722
    public function getZipcode()
723
    {
724
        return $this->zipcode;
725
    }
726
727
    /**
728
     * Set addr01.
729
     *
730
     * @param string|null $addr01
731
     *
732
     * @return Shipping
733
     */
734 52
    public function setAddr01($addr01 = null)
735
    {
736 52
        $this->addr01 = $addr01;
737
738 52
        return $this;
739
    }
740
741
    /**
742
     * Get addr01.
743
     *
744
     * @return string|null
745
     */
746 64
    public function getAddr01()
747
    {
748 64
        return $this->addr01;
749
    }
750
751
    /**
752
     * Set addr02.
753
     *
754
     * @param string|null $addr02
755
     *
756
     * @return Shipping
757
     */
758 52
    public function setAddr02($addr02 = null)
759
    {
760 52
        $this->addr02 = $addr02;
761
762 52
        return $this;
763
    }
764
765
    /**
766
     * Get addr02.
767
     *
768
     * @return string|null
769
     */
770 64
    public function getAddr02()
771
    {
772 64
        return $this->addr02;
773
    }
774
775
    /**
776
     * Set shippingDeliveryName.
777
     *
778
     * @param string|null $shippingDeliveryName
779
     *
780
     * @return Shipping
781
     */
782 186
    public function setShippingDeliveryName($shippingDeliveryName = null)
783
    {
784 186
        $this->shipping_delivery_name = $shippingDeliveryName;
785
786 186
        return $this;
787
    }
788
789
    /**
790
     * Get shippingDeliveryName.
791
     *
792
     * @return string|null
793
     */
794 5
    public function getShippingDeliveryName()
795
    {
796 5
        return $this->shipping_delivery_name;
797
    }
798
799
    /**
800
     * Set shippingDeliveryTime.
801
     *
802
     * @param string|null $shippingDeliveryTime
803
     *
804
     * @return Shipping
805
     */
806 20
    public function setShippingDeliveryTime($shippingDeliveryTime = null)
807
    {
808 20
        $this->shipping_delivery_time = $shippingDeliveryTime;
809
810 20
        return $this;
811
    }
812
813
    /**
814
     * Get shippingDeliveryTime.
815
     *
816
     * @return string|null
817
     */
818 16
    public function getShippingDeliveryTime()
819
    {
820 16
        return $this->shipping_delivery_time;
821
    }
822
823
    /**
824
     * Set shippingDeliveryDate.
825
     *
826
     * @param \DateTime|null $shippingDeliveryDate
827
     *
828
     * @return Shipping
829
     */
830 5
    public function setShippingDeliveryDate($shippingDeliveryDate = null)
831
    {
832 5
        $this->shipping_delivery_date = $shippingDeliveryDate;
833
834 5
        return $this;
835
    }
836
837
    /**
838
     * Get shippingDeliveryDate.
839
     *
840
     * @return \DateTime|null
841
     */
842 21
    public function getShippingDeliveryDate()
843
    {
844 21
        return $this->shipping_delivery_date;
845
    }
846
847
    /**
848
     * Set shippingDeliveryFee.
849
     *
850
     * @param string|null $shippingDeliveryFee
851
     *
852
     * @return Shipping
853
     */
854 185
    public function setShippingDeliveryFee($shippingDeliveryFee = null)
855
    {
856 185
        $this->shipping_delivery_fee = $shippingDeliveryFee;
857
858 185
        return $this;
859
    }
860
861
    /**
862
     * Get shippingDeliveryFee.
863
     *
864
     * @return string|null
865
     */
866 185
    public function getShippingDeliveryFee()
867
    {
868 185
        return $this->shipping_delivery_fee;
869
    }
870
871
    /**
872
     * Set shippingDate.
873
     *
874
     * @param \DateTime|null $shippingDate
875
     *
876
     * @return Shipping
877
     */
878 8
    public function setShippingDate($shippingDate = null)
879
    {
880 8
        $this->shipping_date = $shippingDate;
881
882 8
        return $this;
883
    }
884
885
    /**
886
     * Get shippingDate.
887
     *
888
     * @return \DateTime|null
889
     */
890 10
    public function getShippingDate()
891
    {
892 10
        return $this->shipping_date;
893
    }
894
895
    /**
896
     * Set sortNo.
897
     *
898
     * @param int|null $sortNo
899
     *
900
     * @return Shipping
901
     */
902
    public function setSortNo($sortNo = null)
903
    {
904
        $this->sort_no = $sortNo;
905
906
        return $this;
907
    }
908
909
    /**
910
     * Get sortNo.
911
     *
912
     * @return int|null
913
     */
914
    public function getSortNo()
915
    {
916
        return $this->sort_no;
917
    }
918
919
    /**
920
     * Set createDate.
921
     *
922
     * @param \DateTime $createDate
923
     *
924
     * @return Shipping
925
     */
926 186
    public function setCreateDate($createDate)
927
    {
928 186
        $this->create_date = $createDate;
929
930 186
        return $this;
931
    }
932
933
    /**
934
     * Get createDate.
935
     *
936
     * @return \DateTime
937
     */
938
    public function getCreateDate()
939
    {
940
        return $this->create_date;
941
    }
942
943
    /**
944
     * Set updateDate.
945
     *
946
     * @param \DateTime $updateDate
947
     *
948
     * @return Shipping
949
     */
950 186
    public function setUpdateDate($updateDate)
951
    {
952 186
        $this->update_date = $updateDate;
953
954 186
        return $this;
955
    }
956
957
    /**
958
     * Get updateDate.
959
     *
960
     * @return \DateTime
961
     */
962 5
    public function getUpdateDate()
963
    {
964 5
        return $this->update_date;
965
    }
966
967
    /**
968
     * Add orderItem.
969
     *
970
     * @param \Eccube\Entity\OrderItem $OrderItem
971
     *
972
     * @return Shipping
973
     */
974 196
    public function addOrderItem(\Eccube\Entity\OrderItem $OrderItem)
975
    {
976 196
        $this->OrderItems[] = $OrderItem;
977
978 196
        return $this;
979
    }
980
981
    /**
982
     * Remove orderItem.
983
     *
984
     * @param \Eccube\Entity\OrderItem $OrderItem
985
     *
986
     * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
987
     */
988 25
    public function removeOrderItem(\Eccube\Entity\OrderItem $OrderItem)
989
    {
990 25
        return $this->OrderItems->removeElement($OrderItem);
991
    }
992
993
    /**
994
     * Get orderItems.
995
     *
996
     * @return \Doctrine\Common\Collections\Collection
997
     */
998 79
    public function getOrderItems()
999
    {
1000 79
        return (new ItemCollection($this->OrderItems))->sort();
1001
    }
1002
1003
    /**
1004
     * 商品の受注明細を取得
1005
     *
1006
     * @return OrderItem[]
1007
     */
1008 60
    public function getProductOrderItems()
1009
    {
1010 60
        $sio = new OrderItemCollection($this->OrderItems->toArray());
1011
1012 60
        return $sio->getProductClasses()->toArray();
1013
    }
1014
1015
    /**
1016
     * Set country.
1017
     *
1018
     * @param \Eccube\Entity\Master\Country|null $country
1019
     *
1020
     * @return Shipping
1021
     */
1022
    public function setCountry(\Eccube\Entity\Master\Country $country = null)
1023
    {
1024
        $this->Country = $country;
1025
1026
        return $this;
1027
    }
1028
1029
    /**
1030
     * Get country.
1031
     *
1032
     * @return \Eccube\Entity\Master\Country|null
1033
     */
1034
    public function getCountry()
1035
    {
1036
        return $this->Country;
1037
    }
1038
1039
    /**
1040
     * Set pref.
1041
     *
1042
     * @param \Eccube\Entity\Master\Pref|null $pref
1043
     *
1044
     * @return Shipping
1045
     */
1046 186
    public function setPref(\Eccube\Entity\Master\Pref $pref = null)
1047
    {
1048 186
        $this->Pref = $pref;
1049
1050 186
        return $this;
1051
    }
1052
1053
    /**
1054
     * Get pref.
1055
     *
1056
     * @return \Eccube\Entity\Master\Pref|null
1057
     */
1058 71
    public function getPref()
1059
    {
1060 71
        return $this->Pref;
1061
    }
1062
1063
    /**
1064
     * Set delivery.
1065
     *
1066
     * @param \Eccube\Entity\Delivery|null $delivery
1067
     *
1068
     * @return Shipping
1069
     */
1070 186
    public function setDelivery(\Eccube\Entity\Delivery $delivery = null)
1071
    {
1072 186
        $this->Delivery = $delivery;
1073
1074 186
        return $this;
1075
    }
1076
1077
    /**
1078
     * Get delivery.
1079
     *
1080
     * @return \Eccube\Entity\Delivery|null
1081
     */
1082 59
    public function getDelivery()
1083
    {
1084 59
        return $this->Delivery;
1085
    }
1086
1087
    /**
1088
     * Product class of shipment item (temp)
1089
     *
1090
     * @return \Eccube\Entity\ProductClass
1091
     */
1092 26
    public function getProductClassOfTemp()
1093
    {
1094 26
        return $this->ProductClassOfTemp;
1095
    }
1096
1097
    /**
1098
     * Product class of shipment item (temp)
1099
     *
1100
     * @param \Eccube\Entity\ProductClass $ProductClassOfTemp
1101
     *
1102
     * @return $this
1103
     */
1104 26
    public function setProductClassOfTemp(\Eccube\Entity\ProductClass $ProductClassOfTemp)
1105
    {
1106 26
        $this->ProductClassOfTemp = $ProductClassOfTemp;
1107
1108 26
        return $this;
1109
    }
1110
1111
    /**
1112
     * Get orders.
1113
     *
1114
     * @return \Doctrine\Common\Collections\Collection
1115
     */
1116 13
    public function getOrders()
1117
    {
1118 13
        $Orders = [];
1119 13
        foreach ($this->getOrderItems() as $OrderItem) {
1120 12
            $Order = $OrderItem->getOrder();
1121 12
            if (is_object($Order)) {
1122 12
                $name = $Order->getName01(); // XXX lazy loading
0 ignored issues
show
Unused Code introduced by
$name is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
1123 12
                $Orders[$Order->getId()] = $Order;
1124
            }
1125
        }
1126 13
        $Result = new \Doctrine\Common\Collections\ArrayCollection();
1127 13
        foreach ($Orders as $Order) {
1128 12
            $Result->add($Order);
1129
        }
1130
1131 13
        return $Result;
1132
        // XXX 以下のロジックだと何故か空の Collection になってしまう場合がある
1133
        // return new \Doctrine\Common\Collections\ArrayCollection(array_values($Orders));
1134
    }
1135
1136
    /**
1137
     * Set trackingNumber
1138
     *
1139
     * @param string $trackingNumber
1140
     *
1141
     * @return Shipping
1142
     */
1143
    public function setTrackingNumber($trackingNumber)
1144
    {
1145
        $this->tracking_number = $trackingNumber;
1146
1147
        return $this;
1148
    }
1149
1150
    /**
1151
     * Get trackingNumber
1152
     *
1153
     * @return string
1154
     */
1155 11
    public function getTrackingNumber()
1156
    {
1157 11
        return $this->tracking_number;
1158
    }
1159
1160
    /**
1161
     * Set note.
1162
     *
1163
     * @param string|null $note
1164
     *
1165
     * @return Shipping
1166
     */
1167
    public function setNote($note = null)
1168
    {
1169
        $this->note = $note;
1170
1171
        return $this;
1172
    }
1173
1174
    /**
1175
     * Get note.
1176
     *
1177
     * @return string|null
1178
     */
1179 7
    public function getNote()
1180
    {
1181 7
        return $this->note;
1182
    }
1183
1184
    /**
1185
     * Set ShippingStatus.
1186
     *
1187
     * @param ShippingStatus $ShippingStatus
1188
     *
1189
     * @return $this
1190
     */
1191 186
    public function setShippingStatus(ShippingStatus $ShippingStatus)
1192
    {
1193 186
        $this->ShippingStatus = $ShippingStatus;
1194
1195 186
        return $this;
1196
    }
1197
1198
    /**
1199
     * Get ShippingStatus
1200
     *
1201
     * @return ShippingStatus
1202
     */
1203 11
    public function getShippingStatus()
1204
    {
1205 11
        return $this->ShippingStatus;
1206
    }
1207
1208
    /**
1209
     * Set timeId
1210
     *
1211
     * @param integer $timeId
1212
     *
1213
     * @return Shipping
1214
     */
1215 20
    public function setTimeId($timeId)
1216
    {
1217 20
        $this->time_id = $timeId;
1218
1219 20
        return $this;
1220
    }
1221
1222
    /**
1223
     * Get timeId
1224
     *
1225
     * @return integer
1226
     */
1227 6
    public function getTimeId()
1228
    {
1229 6
        return $this->time_id;
1230
    }
1231
1232
    /**
1233
     * Set feeId
1234
     *
1235
     * @param integer $feeId
1236
     *
1237
     * @return Shipping
1238
     */
1239 185
    public function setFeeId($feeId)
1240
    {
1241 185
        $this->fee_id = $feeId;
1242
1243 185
        return $this;
1244
    }
1245
1246
    /**
1247
     * Get feeId
1248
     *
1249
     * @return integer
1250
     */
1251
    public function getFeeId()
1252
    {
1253
        return $this->fee_id;
1254
    }
1255
1256
    /**
1257
     * Set creator.
1258
     *
1259
     * @param \Eccube\Entity\Member|null $creator
1260
     *
1261
     * @return Shipping
1262
     */
1263 7
    public function setCreator(\Eccube\Entity\Member $creator = null)
1264
    {
1265 7
        $this->Creator = $creator;
1266
1267 7
        return $this;
1268
    }
1269
1270
    /**
1271
     * Get creator.
1272
     *
1273
     * @return \Eccube\Entity\Member|null
1274
     */
1275 5
    public function getCreator()
1276
    {
1277 5
        return $this->Creator;
1278
    }
1279
}
1280