Failed Conditions
Push — 4.0 ( f3e983...d5d6e1 )
by Ryo
22s queued 10s
created

Order::getTaxableTotal()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 10
ccs 0
cts 4
cp 0
crap 6
rs 9.9332
c 0
b 0
f 0
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\Common\Collections\ArrayCollection;
17
use Doctrine\Common\Collections\Criteria;
18
use Doctrine\ORM\Mapping as ORM;
19
use Eccube\Entity\Master\TaxType;
20
use Eccube\Service\Calculator\OrderItemCollection;
21
use Eccube\Service\PurchaseFlow\ItemCollection;
22 1
23
if (!class_exists('\Eccube\Entity\Order')) {
24
    /**
25
     * Order
26
     *
27
     * @ORM\Table(name="dtb_order", indexes={
28
     *     @ORM\Index(name="dtb_order_email_idx", columns={"email"}),
29
     *     @ORM\Index(name="dtb_order_order_date_idx", columns={"order_date"}),
30
     *     @ORM\Index(name="dtb_order_payment_date_idx", columns={"payment_date"}),
31
     *     @ORM\Index(name="dtb_order_update_date_idx", columns={"update_date"}),
32
     *     @ORM\Index(name="dtb_order_order_no_idx", columns={"order_no"})
33
     *  },
34
     *  uniqueConstraints={
35
     *     @ORM\UniqueConstraint(name="dtb_order_pre_order_id_idx", columns={"pre_order_id"})
36
     *  })
37
     * @ORM\InheritanceType("SINGLE_TABLE")
38
     * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
39
     * @ORM\HasLifecycleCallbacks()
40
     * @ORM\Entity(repositoryClass="Eccube\Repository\OrderRepository")
41
     */
42
    class Order extends \Eccube\Entity\AbstractEntity implements PurchaseInterface, ItemHolderInterface
43
    {
44
        use NameTrait, PointTrait;
45
46
        /**
47
         * 課税対象の明細を返す.
48 65
         *
49
         * @return array
50 65
         */
51
        public function getTaxableItems()
52
        {
53 65
            $Items = [];
54 64
55 62
            foreach ($this->OrderItems as $Item) {
56 62
                if ($Item->getTaxType()->getId() == TaxType::TAXATION) {
57 62
                    $Items[] = $Item;
58
                }
59 64
            }
60
61
            return $Items;
62
        }
63 65
64
        /**
65
         * 課税対象の明細の合計金額を返す.
66
         * 商品合計 + 送料 + 手数料 + 値引き(課税).
67
         */
68
        public function getTaxableTotal()
69
        {
70
            $total = 0;
71
72
            foreach ($this->getTaxableItems() as $Item) {
73
                $total += $Item->getTotalPrice();
74
            }
75
76
            return $total;
77
        }
78
79
        /**
80
         * 課税対象の明細の合計金額を、税率ごとに集計する.
81
         *
82
         * @return array
83
         */
84
        public function getTaxableTotalByTaxRate()
85
        {
86
            $total = [];
87
88
            foreach ($this->getTaxableItems() as $Item) {
89 1
                    $totalPrice = $Item->getTotalPrice();
90
                    $taxRate = $Item->getTaxRate();
91 1
                    $total[$taxRate] = isset($total[$taxRate])
92 1
                        ? $total[$taxRate] + $totalPrice
93
                        : $totalPrice;
94 1
            }
95 1
96 1
            krsort($total);
97
98
            return $total;
99
        }
100 1
101
        /**
102
         * 課税対象の値引き明細を返す.
103
         *
104
         * @return array
105
         */
106
        public function getTaxableDiscountItems()
107
        {
108 1
            return array_filter($this->getTaxableItems(), function(OrderItem $Item) {
109
                return $Item->isDiscount();
110 1
            });
111 1
        }
112
113 1
        /**
114 1
         * 課税対象の値引き金額合計を返す.
115 1
         *
116
         * @return mixed
117
         */
118 1
        public function getTaxableDiscount()
119 1
        {
120 1
            return array_reduce($this->getTaxableDiscountItems(), function ($sum, OrderItem $Item) {
121
                return $sum += $Item->getTotalPrice();
122
            }, 0);
123 1
        }
124
125 1
        /**
126 1
         * 非課税・不課税の値引き明細を返す.
127 1
         *
128 1
         * @return array
129 1
         */
130 1
        public function getTaxFreeDiscountItems()
131 1
        {
132 1
            return array_filter($this->OrderItems->toArray(), function(OrderItem $Item) {
133
                return $Item->isPoint() || ($Item->isDiscount() && $Item->getTaxType()->getId() != TaxType::TAXATION);
134
            });
135
        }
136 1
137
        /**
138
         * 複数配送かどうかの判定を行う.
139
         *
140
         * @return boolean
141
         */
142
        public function isMultiple()
143
        {
144
            $Shippings = [];
145
            // クエリビルダ使用時に絞り込まれる場合があるため,
146 1
            // getShippingsではなくOrderItem経由でShippingを取得する.
147
            foreach ($this->getOrderItems() as $OrderItem) {
148 1
                if ($Shipping = $OrderItem->getShipping()) {
149
                    $id = $Shipping->getId();
150 1
                    if (isset($Shippings[$id])) {
151
                        continue;
152
                    }
153
                    $Shippings[$id] = $Shipping;
154
                }
155
            }
156
157
            return count($Shippings) > 1 ? true : false;
158
        }
159
160
        /**
161
         * 対象となるお届け先情報を取得
162
         *
163
         * @param integer $shippingId
164
         *
165
         * @return \Eccube\Entity\Shipping|null
166
         */
167
        public function findShipping($shippingId)
168
        {
169
            foreach ($this->getShippings() as $Shipping) {
170
                if ($Shipping->getId() == $shippingId) {
171
                    return $Shipping;
172
                }
173
            }
174
175
            return null;
176
        }
177
178
        /**
179
         * この注文の保持する販売種別を取得します.
180
         *
181
         * @return \Eccube\Entity\Master\SaleType[] 一意な販売種別の配列
182
         */
183
        public function getSaleTypes()
184
        {
185
            $saleTypes = [];
186
            foreach ($this->getOrderItems() as $OrderItem) {
187
                /* @var $ProductClass \Eccube\Entity\ProductClass */
188
                $ProductClass = $OrderItem->getProductClass();
189
                if ($ProductClass) {
190
                    $saleTypes[] = $ProductClass->getSaleType();
191
                }
192
            }
193
194
            return array_unique($saleTypes);
195
        }
196
197
        /**
198
         * 同じ規格の商品の個数をまとめた受注明細を取得
199
         *
200
         * @return OrderItem[]
201
         */
202
        public function getMergedProductOrderItems()
203
        {
204
            $ProductOrderItems = $this->getProductOrderItems();
205
            $orderItemArray = [];
206
            /** @var OrderItem $ProductOrderItem */
207
            foreach ($ProductOrderItems as $ProductOrderItem) {
208
                $productClassId = $ProductOrderItem->getProductClass()->getId();
209
                if (array_key_exists($productClassId, $orderItemArray)) {
210
                    // 同じ規格の商品がある場合は個数をまとめる
211
                    /** @var ItemInterface $OrderItem */
212
                    $OrderItem = $orderItemArray[$productClassId];
213
                    $quantity = $OrderItem->getQuantity() + $ProductOrderItem->getQuantity();
214
                    $OrderItem->setQuantity($quantity);
215
                } else {
216
                    // 新規規格の商品は新しく追加する
217
                    $OrderItem = new OrderItem();
218
                    $OrderItem->setOrder($ProductOrderItem->getOrder());
219
                    $OrderItem
220
                    ->setProduct($ProductOrderItem->getProduct())
221
                    ->setProductName($ProductOrderItem->getProductName())
222
                    ->setProductCode($ProductOrderItem->getProductCode())
223
                    ->setClassCategoryName1($ProductOrderItem->getClassCategoryName1())
224
                    ->setClassCategoryName2($ProductOrderItem->getClassCategoryName2())
225
                    ->setPrice($ProductOrderItem->getPrice())
226
                    ->setTax($ProductOrderItem->getTax())
227
                    ->setTaxRate($ProductOrderItem->getTaxRate())
228
                    ->setQuantity($ProductOrderItem->getQuantity());
229
                    $orderItemArray[$productClassId] = $OrderItem;
230
                }
231
            }
232
233
            return array_values($orderItemArray);
234
        }
235
236
        /**
237
         * 合計金額を計算
238
         *
239
         * @return string
240
         *
241
         * @deprecated
242
         */
243
        public function getTotalPrice()
244
        {
245
            @trigger_error('The '.__METHOD__.' method is deprecated.', E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
246
247
            return $this->getPaymentTotal();
248
        }
249
250
        /**
251
         * @var integer
252
         *
253
         * @ORM\Column(name="id", type="integer", options={"unsigned":true})
254
         * @ORM\Id
255
         * @ORM\GeneratedValue(strategy="IDENTITY")
256
         */
257
        private $id;
258
259
        /**
260
         * @var string|null
261
         *
262
         * @ORM\Column(name="pre_order_id", type="string", length=255, nullable=true)
263
         */
264
        private $pre_order_id;
265
266
        /**
267
         * @var string|null
268
         *
269
         * @ORM\Column(name="order_no", type="string", length=255, nullable=true)
270
         */
271
        private $order_no;
272
273
        /**
274
         * @var string|null
275
         *
276
         * @ORM\Column(name="message", type="string", length=4000, nullable=true)
277
         */
278
        private $message;
279
280
        /**
281
         * @var string|null
282
         *
283
         * @ORM\Column(name="name01", type="string", length=255)
284
         */
285
        private $name01;
286
287
        /**
288
         * @var string|null
289
         *
290
         * @ORM\Column(name="name02", type="string", length=255)
291
         */
292
        private $name02;
293
294
        /**
295
         * @var string|null
296
         *
297
         * @ORM\Column(name="kana01", type="string", length=255, nullable=true)
298
         */
299
        private $kana01;
300
301
        /**
302
         * @var string|null
303
         *
304
         * @ORM\Column(name="kana02", type="string", length=255, nullable=true)
305
         */
306
        private $kana02;
307
308
        /**
309
         * @var string|null
310
         *
311
         * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
312
         */
313
        private $company_name;
314
315
        /**
316
         * @var string|null
317
         *
318
         * @ORM\Column(name="email", type="string", length=255, nullable=true)
319
         */
320
        private $email;
321
322
        /**
323
         * @var string|null
324
         *
325
         * @ORM\Column(name="phone_number", type="string", length=14, nullable=true)
326
         */
327
        private $phone_number;
328
329
        /**
330
         * @var string|null
331
         *
332
         * @ORM\Column(name="postal_code", type="string", length=8, nullable=true)
333
         */
334
        private $postal_code;
335
336
        /**
337
         * @var string|null
338
         *
339
         * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
340
         */
341
        private $addr01;
342
343
        /**
344
         * @var string|null
345
         *
346
         * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
347
         */
348
        private $addr02;
349
350
        /**
351
         * @var \DateTime|null
352
         *
353
         * @ORM\Column(name="birth", type="datetimetz", nullable=true)
354
         */
355
        private $birth;
356
357
        /**
358
         * @var string
359
         *
360
         * @ORM\Column(name="subtotal", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
361
         */
362
        private $subtotal = 0;
363
364
        /**
365
         * @var string
366
         *
367
         * @ORM\Column(name="discount", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
368
         */
369
        private $discount = 0;
370
371
        /**
372
         * @var string
373
         *
374
         * @ORM\Column(name="delivery_fee_total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
375
         */
376
        private $delivery_fee_total = 0;
377
378
        /**
379
         * @var string
380
         *
381
         * @ORM\Column(name="charge", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
382
         */
383
        private $charge = 0;
384
385
        /**
386
         * @var string
387
         *
388
         * @ORM\Column(name="tax", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
389
         *
390
         * @deprecated 明細ごとに集計した税額と差異が発生する場合があるため非推奨
391
         */
392
        private $tax = 0;
393
394
        /**
395
         * @var string
396
         *
397
         * @ORM\Column(name="total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
398
         */
399
        private $total = 0;
400
401
        /**
402
         * @var string
403
         *
404
         * @ORM\Column(name="payment_total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
405
         */
406
        private $payment_total = 0;
407
408
        /**
409
         * @var string|null
410
         *
411
         * @ORM\Column(name="payment_method", type="string", length=255, nullable=true)
412
         */
413
        private $payment_method;
414
415
        /**
416
         * @var string|null
417
         *
418
         * @ORM\Column(name="note", type="string", length=4000, nullable=true)
419
         */
420
        private $note;
421
422
        /**
423
         * @var \DateTime
424
         *
425
         * @ORM\Column(name="create_date", type="datetimetz")
426
         */
427
        private $create_date;
428
429
        /**
430
         * @var \DateTime
431
         *
432
         * @ORM\Column(name="update_date", type="datetimetz")
433
         */
434
        private $update_date;
435
436
        /**
437
         * @var \DateTime|null
438
         *
439
         * @ORM\Column(name="order_date", type="datetimetz", nullable=true)
440
         */
441
        private $order_date;
442
443
        /**
444
         * @var \DateTime|null
445
         *
446
         * @ORM\Column(name="payment_date", type="datetimetz", nullable=true)
447
         */
448
        private $payment_date;
449
450
        /**
451
         * @var string|null
452
         *
453
         * @ORM\Column(name="currency_code", type="string", nullable=true)
454
         */
455
        private $currency_code;
456
457
        /**
458
         * 注文完了画面に表示するメッセージ
459
         *
460
         * プラグインから注文完了時にメッセージを表示したい場合, このフィールドにセットすることで, 注文完了画面で表示されます。
461
         * 複数のプラグインから利用されるため, appendCompleteMesssage()で追加してください.
462
         * 表示する際にHTMLは利用可能です。
463
         *
464
         * @var string|null
465
         *
466
         * @ORM\Column(name="complete_message", type="text", nullable=true)
467
         */
468
        private $complete_message;
469
470
        /**
471
         * 注文完了メールに表示するメッセージ
472
         *
473
         * プラグインから注文完了メールにメッセージを表示したい場合, このフィールドにセットすることで, 注文完了メールで表示されます。
474
         * 複数のプラグインから利用されるため, appendCompleteMailMesssage()で追加してください.
475
         *
476
         * @var string|null
477
         *
478
         * @ORM\Column(name="complete_mail_message", type="text", nullable=true)
479
         */
480
        private $complete_mail_message;
481
482
        /**
483
         * @var \Doctrine\Common\Collections\Collection|OrderItem[]
484
         *
485
         * @ORM\OneToMany(targetEntity="Eccube\Entity\OrderItem", mappedBy="Order", cascade={"persist","remove"})
486
         */
487
        private $OrderItems;
488
489
        /**
490
         * @var \Doctrine\Common\Collections\Collection|Shipping[]
491
         *
492
         * @ORM\OneToMany(targetEntity="Eccube\Entity\Shipping", mappedBy="Order", cascade={"persist","remove"})
493
         */
494
        private $Shippings;
495
496
        /**
497
         * @var \Doctrine\Common\Collections\Collection
498
         *
499
         * @ORM\OneToMany(targetEntity="Eccube\Entity\MailHistory", mappedBy="Order", cascade={"remove"})
500
         * @ORM\OrderBy({
501 356
         *     "send_date"="DESC"
502
         * })
503 356
         */
504 356
        private $MailHistories;
505 356
506 356
        /**
507 356
         * @var \Eccube\Entity\Customer
508 356
         *
509 356
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer", inversedBy="Orders")
510 356
         * @ORM\JoinColumns({
511
         *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
512
         * })
513 356
         */
514 356
        private $Customer;
515 356
516
        /**
517
         * @var \Eccube\Entity\Master\Country
518
         *
519
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
520
         * @ORM\JoinColumns({
521 7
         *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
522
         * })
523 7
         */
524 7
        private $Country;
525 4
526
        /**
527 7
         * @var \Eccube\Entity\Master\Pref
528
         *
529
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
530
         * @ORM\JoinColumns({
531
         *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
532
         * })
533
         */
534
        private $Pref;
535 124
536
        /**
537 124
         * @var \Eccube\Entity\Master\Sex
538
         *
539
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Sex")
540
         * @ORM\JoinColumns({
541
         *   @ORM\JoinColumn(name="sex_id", referencedColumnName="id")
542
         * })
543
         */
544
        private $Sex;
545
546
        /**
547 205
         * @var \Eccube\Entity\Master\Job
548
         *
549 205
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Job")
550
         * @ORM\JoinColumns({
551 205
         *   @ORM\JoinColumn(name="job_id", referencedColumnName="id")
552
         * })
553
         */
554
        private $Job;
555
556
        /**
557
         * @var \Eccube\Entity\Payment
558
         *
559 53
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Payment")
560
         * @ORM\JoinColumns({
561 53
         *   @ORM\JoinColumn(name="payment_id", referencedColumnName="id")
562
         * })
563
         */
564
        private $Payment;
565
566
        /**
567
         * @var \Eccube\Entity\Master\DeviceType
568
         *
569
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\DeviceType")
570
         * @ORM\JoinColumns({
571 227
         *   @ORM\JoinColumn(name="device_type_id", referencedColumnName="id")
572
         * })
573 227
         */
574
        private $DeviceType;
575 227
576
        /**
577
         * OrderStatusより先にプロパティを定義しておかないとセットされなくなる
578
         *
579
         * @var \Eccube\Entity\Master\CustomerOrderStatus
580
         *
581
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\CustomerOrderStatus")
582
         * @ORM\JoinColumns({
583 97
         *   @ORM\JoinColumn(name="order_status_id", referencedColumnName="id")
584
         * })
585 97
         */
586
        private $CustomerOrderStatus;
587
588
        /**
589
         * OrderStatusより先にプロパティを定義しておかないとセットされなくなる
590
         *
591
         * @var \Eccube\Entity\Master\OrderStatusColor
592
         *
593
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\OrderStatusColor")
594
         * @ORM\JoinColumns({
595 181
         *   @ORM\JoinColumn(name="order_status_id", referencedColumnName="id")
596
         * })
597 181
         */
598
        private $OrderStatusColor;
599 181
600
        /**
601
         * @var \Eccube\Entity\Master\OrderStatus
602
         *
603
         * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\OrderStatus")
604
         * @ORM\JoinColumns({
605
         *   @ORM\JoinColumn(name="order_status_id", referencedColumnName="id")
606
         * })
607 81
         */
608
        private $OrderStatus;
609 81
610
        /**
611
         * Constructor
612
         */
613
        public function __construct(\Eccube\Entity\Master\OrderStatus $orderStatus = null)
614
        {
615
            $this->setDiscount(0)
0 ignored issues
show
Deprecated Code introduced by
The method Eccube\Entity\Order::setTax() has been deprecated with message: 明細ごとに集計した税額と差異が発生する場合があるため非推奨

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
616
            ->setSubtotal(0)
617
            ->setTotal(0)
618
            ->setPaymentTotal(0)
619 18
            ->setCharge(0)
620
            ->setTax(0)
621 18
            ->setDeliveryFeeTotal(0)
622
            ->setOrderStatus($orderStatus)
623 18
        ;
624
625
            $this->OrderItems = new \Doctrine\Common\Collections\ArrayCollection();
626
            $this->Shippings = new \Doctrine\Common\Collections\ArrayCollection();
627
            $this->MailHistories = new \Doctrine\Common\Collections\ArrayCollection();
628
        }
629
630
        /**
631 80
         * Clone
632
         */
633 80
        public function __clone()
634
        {
635
            $OriginOrderItems = $this->OrderItems;
0 ignored issues
show
Unused Code introduced by
$OriginOrderItems 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...
636
            $OrderItems = new ArrayCollection();
637
            foreach ($this->OrderItems as $OrderItem) {
638
                $OrderItems->add(clone $OrderItem);
639
            }
640
            $this->OrderItems = $OrderItems;
641
642
//            // ShippingとOrderItemが循環参照するため, 手動でヒモ付を変更する.
643 18
//            $Shippings = new ArrayCollection();
644
//            foreach ($this->Shippings as $Shipping) {
645 18
//                $CloneShipping = clone $Shipping;
646
//                foreach ($OriginOrderItems as $OrderItem) {
647 18
//                    //$CloneShipping->removeOrderItem($OrderItem);
648
//                }
649
//                foreach ($this->OrderItems as $OrderItem) {
650
//                    if ($OrderItem->getShipping() && $OrderItem->getShipping()->getId() == $Shipping->getId()) {
651
//                        $OrderItem->setShipping($CloneShipping);
652
//                    }
653
//                    $CloneShipping->addOrderItem($OrderItem);
654
//                }
655 80
//                $Shippings->add($CloneShipping);
656
//            }
657 80
//            $this->Shippings = $Shippings;
658
        }
659
660
        /**
661
         * Get id.
662
         *
663
         * @return int
664
         */
665
        public function getId()
666
        {
667 19
            return $this->id;
668
        }
669 19
670
        /**
671 19
         * Set preOrderId.
672
         *
673
         * @param string|null $preOrderId
674
         *
675
         * @return Order
676
         */
677
        public function setPreOrderId($preOrderId = null)
678
        {
679 70
            $this->pre_order_id = $preOrderId;
680
681 70
            return $this;
682
        }
683
684
        /**
685
         * Get preOrderId.
686
         *
687
         * @return string|null
688
         */
689
        public function getPreOrderId()
690
        {
691 19
            return $this->pre_order_id;
692
        }
693 19
694
        /**
695 19
         * Set orderNo
696
         *
697
         * @param string|null $orderNo
698
         *
699
         * @return Order
700
         */
701
        public function setOrderNo($orderNo = null)
702
        {
703 70
            $this->order_no = $orderNo;
704
705 70
            return $this;
706
        }
707
708
        /**
709
         * Get orderNo
710
         *
711
         * @return string|null
712
         */
713
        public function getOrderNo()
714
        {
715 16
            return $this->order_no;
716
        }
717 16
718
        /**
719 16
         * Set message.
720
         *
721
         * @param string|null $message
722
         *
723
         * @return Order
724
         */
725
        public function setMessage($message = null)
726
        {
727 71
            $this->message = $message;
728
729 71
            return $this;
730
        }
731
732
        /**
733
         * Get message.
734
         *
735
         * @return string|null
736
         */
737
        public function getMessage()
738
        {
739 16
            return $this->message;
740
        }
741 16
742
        /**
743 16
         * Set name01.
744
         *
745
         * @param string|null $name01
746
         *
747
         * @return Order
748
         */
749
        public function setName01($name01 = null)
750
        {
751 74
            $this->name01 = $name01;
752
753 74
            return $this;
754
        }
755
756
        /**
757
         * Get name01.
758
         *
759
         * @return string|null
760
         */
761
        public function getName01()
762
        {
763 17
            return $this->name01;
764
        }
765 17
766
        /**
767 17
         * Set name02.
768
         *
769
         * @param string|null $name02
770
         *
771
         * @return Order
772
         */
773
        public function setName02($name02 = null)
774
        {
775 70
            $this->name02 = $name02;
776
777 70
            return $this;
778
        }
779
780
        /**
781
         * Get name02.
782
         *
783
         * @return string|null
784
         */
785
        public function getName02()
786
        {
787 16
            return $this->name02;
788
        }
789 16
790
        /**
791 16
         * Set kana01.
792
         *
793
         * @param string|null $kana01
794
         *
795
         * @return Order
796
         */
797
        public function setKana01($kana01 = null)
798
        {
799 70
            $this->kana01 = $kana01;
800
801 70
            return $this;
802
        }
803
804
        /**
805
         * Get kana01.
806
         *
807
         * @return string|null
808
         */
809
        public function getKana01()
810
        {
811 16
            return $this->kana01;
812
        }
813 16
814
        /**
815 16
         * Set kana02.
816
         *
817
         * @param string|null $kana02
818
         *
819
         * @return Order
820
         */
821
        public function setKana02($kana02 = null)
822
        {
823 73
            $this->kana02 = $kana02;
824
825 73
            return $this;
826
        }
827
828
        /**
829
         * Get kana02.
830
         *
831
         * @return string|null
832
         */
833
        public function getKana02()
834
        {
835 16
            return $this->kana02;
836
        }
837 16
838
        /**
839 16
         * Set companyName.
840
         *
841
         * @param string|null $companyName
842
         *
843
         * @return Order
844
         */
845
        public function setCompanyName($companyName = null)
846
        {
847 73
            $this->company_name = $companyName;
848
849 73
            return $this;
850
        }
851
852
        /**
853
         * Get companyName.
854
         *
855
         * @return string|null
856
         */
857
        public function getCompanyName()
858
        {
859 5
            return $this->company_name;
860
        }
861 5
862
        /**
863 5
         * Set email.
864
         *
865
         * @param string|null $email
866
         *
867
         * @return Order
868
         */
869
        public function setEmail($email = null)
870
        {
871 3
            $this->email = $email;
872
873 3
            return $this;
874
        }
875
876
        /**
877
         * Get email.
878
         *
879
         * @return string|null
880
         */
881
        public function getEmail()
882
        {
883 356
            return $this->email;
884
        }
885 356
886
        /**
887 356
         * Set phone_number.
888
         *
889
         * @param string|null $phone_number
890
         *
891
         * @return Order
892
         */
893
        public function setPhoneNumber($phone_number = null)
894
        {
895 60
            $this->phone_number = $phone_number;
896
897 60
            return $this;
898
        }
899
900
        /**
901
         * Get phone_number.
902
         *
903
         * @return string|null
904
         */
905
        public function getPhoneNumber()
906
        {
907 356
            return $this->phone_number;
908
        }
909 356
910
        /**
911 356
         * Set postal_code.
912
         *
913
         * @param string|null $postal_code
914
         *
915
         * @return Order
916
         */
917
        public function setPostalCode($postal_code = null)
918
        {
919 212
            $this->postal_code = $postal_code;
920
921 212
            return $this;
922
        }
923
924
        /**
925
         * Get postal_code.
926
         *
927
         * @return string|null
928
         */
929
        public function getPostalCode()
930
        {
931 356
            return $this->postal_code;
932
        }
933 356
934
        /**
935 356
         * Set addr01.
936
         *
937
         * @param string|null $addr01
938
         *
939
         * @return Order
940
         */
941
        public function setAddr01($addr01 = null)
942
        {
943 75
            $this->addr01 = $addr01;
944
945 75
            return $this;
946
        }
947
948
        /**
949
         * Get addr01.
950
         *
951
         * @return string|null
952
         */
953
        public function getAddr01()
954
        {
955 356
            return $this->addr01;
956
        }
957 356
958
        /**
959 356
         * Set addr02.
960
         *
961
         * @param string|null $addr02
962
         *
963
         * @return Order
964
         */
965
        public function setAddr02($addr02 = null)
966
        {
967 212
            $this->addr02 = $addr02;
968
969 212
            return $this;
970
        }
971
972
        /**
973
         * Get addr02.
974
         *
975
         * @return string|null
976
         */
977
        public function getAddr02()
978
        {
979 356
            return $this->addr02;
980
        }
981 356
982
        /**
983 356
         * Set birth.
984
         *
985
         * @param \DateTime|null $birth
986
         *
987
         * @return Order
988
         */
989
        public function setBirth($birth = null)
990
        {
991 16
            $this->birth = $birth;
992
993 16
            return $this;
994
        }
995
996
        /**
997
         * Get birth.
998
         *
999
         * @return \DateTime|null
1000
         */
1001
        public function getBirth()
1002
        {
1003 356
            return $this->birth;
1004
        }
1005 356
1006
        /**
1007 356
         * Set subtotal.
1008
         *
1009
         * @param string $subtotal
1010
         *
1011
         * @return Order
1012
         */
1013
        public function setSubtotal($subtotal)
1014
        {
1015 237
            $this->subtotal = $subtotal;
1016
1017 237
            return $this;
1018
        }
1019
1020
        /**
1021
         * Get subtotal.
1022
         *
1023
         * @return string
1024
         */
1025
        public function getSubtotal()
1026
        {
1027 356
            return $this->subtotal;
1028
        }
1029 356
1030
        /**
1031 356
         * Set discount.
1032
         *
1033
         * @param string $discount
1034
         *
1035
         * @return Order
1036
         */
1037
        public function setDiscount($discount)
1038
        {
1039 28
            $this->discount = $discount;
1040
1041 28
            return $this;
1042
        }
1043
1044
        /**
1045
         * Get discount.
1046
         *
1047
         * @deprecated 4.0.3 から値引きは課税値引きと 非課税・不課税の値引きの2種に分かれる. 課税値引きについてはgetTaxableDiscountを利用してください.
1048
         * @return string
1049
         */
1050
        public function getDiscount()
1051 218
        {
1052
            return $this->discount;
1053 218
        }
1054
1055 218
        /**
1056
         * Set deliveryFeeTotal.
1057
         *
1058
         * @param string $deliveryFeeTotal
1059
         *
1060
         * @return Order
1061
         */
1062
        public function setDeliveryFeeTotal($deliveryFeeTotal)
1063 20
        {
1064
            $this->delivery_fee_total = $deliveryFeeTotal;
1065 20
1066
            return $this;
1067
        }
1068
1069
        /**
1070
         * Get deliveryFeeTotal.
1071
         *
1072
         * @return string
1073
         */
1074
        public function getDeliveryFeeTotal()
1075 156
        {
1076
            return $this->delivery_fee_total;
1077 156
        }
1078
1079 156
        /**
1080
         * Set charge.
1081
         *
1082
         * @param string $charge
1083
         *
1084
         * @return Order
1085
         */
1086
        public function setCharge($charge)
1087 20
        {
1088
            $this->charge = $charge;
1089 20
1090
            return $this;
1091
        }
1092
1093
        /**
1094
         * Get charge.
1095
         *
1096
         * @return string
1097
         */
1098
        public function getCharge()
1099 207
        {
1100
            return $this->charge;
1101 207
        }
1102
1103 207
        /**
1104
         * Set tax.
1105
         *
1106
         * @param string $tax
1107
         *
1108
         * @return Order
1109
         *
1110
         * @deprecated 明細ごとに集計した税額と差異が発生する場合があるため非推奨
1111 3
         */
1112
        public function setTax($tax)
1113 3
        {
1114
            $this->tax = $tax;
0 ignored issues
show
Deprecated Code introduced by
The property Eccube\Entity\Order::$tax has been deprecated with message: 明細ごとに集計した税額と差異が発生する場合があるため非推奨

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
1115
1116
            return $this;
1117
        }
1118
1119
        /**
1120
         * Get tax.
1121
         *
1122
         * @return string
1123 207
         *
1124
         * @deprecated 明細ごとに集計した税額と差異が発生する場合があるため非推奨
1125 207
         */
1126
        public function getTax()
1127 207
        {
1128
            return $this->tax;
0 ignored issues
show
Deprecated Code introduced by
The property Eccube\Entity\Order::$tax has been deprecated with message: 明細ごとに集計した税額と差異が発生する場合があるため非推奨

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
1129
        }
1130
1131
        /**
1132
         * Set total.
1133
         *
1134
         * @param string $total
1135 2
         *
1136
         * @return Order
1137 2
         */
1138
        public function setTotal($total)
1139
        {
1140
            $this->total = $total;
1141
1142
            return $this;
1143
        }
1144
1145
        /**
1146
         * Get total.
1147 47
         *
1148
         * @return string
1149 47
         */
1150
        public function getTotal()
1151 47
        {
1152
            return $this->total;
1153
        }
1154
1155
        /**
1156
         * Set paymentTotal.
1157
         *
1158
         * @param string $paymentTotal
1159 33
         *
1160
         * @return Order
1161 33
         */
1162
        public function setPaymentTotal($paymentTotal)
1163
        {
1164
            $this->payment_total = $paymentTotal;
1165
1166
            return $this;
1167
        }
1168
1169
        /**
1170
         * Get paymentTotal.
1171 4
         *
1172
         * @return string
1173 4
         */
1174
        public function getPaymentTotal()
1175 4
        {
1176
            return $this->payment_total;
1177
        }
1178
1179
        /**
1180
         * Set paymentMethod.
1181
         *
1182
         * @param string|null $paymentMethod
1183 15
         *
1184
         * @return Order
1185 15
         */
1186
        public function setPaymentMethod($paymentMethod = null)
1187
        {
1188
            $this->payment_method = $paymentMethod;
1189
1190
            return $this;
1191
        }
1192
1193
        /**
1194
         * Get paymentMethod.
1195
         *
1196
         * @return string|null
1197
         */
1198
        public function getPaymentMethod()
1199
        {
1200
            return $this->payment_method;
1201
        }
1202
1203
        /**
1204
         * Set note.
1205 207
         *
1206
         * @param string|null $note
1207 207
         *
1208
         * @return Order
1209 207
         */
1210
        public function setNote($note = null)
1211
        {
1212
            $this->note = $note;
1213
1214
            return $this;
1215 1
        }
1216
1217 1
        /**
1218
         * Get note.
1219
         *
1220
         * @return string|null
1221
         */
1222
        public function getNote()
1223
        {
1224
            return $this->note;
1225
        }
1226
1227
        /**
1228
         * Set createDate.
1229
         *
1230
         * @param \DateTime $createDate
1231
         *
1232
         * @return Order
1233
         */
1234
        public function setCreateDate($createDate)
1235
        {
1236
            $this->create_date = $createDate;
1237
1238
            return $this;
1239
        }
1240
1241
        /**
1242
         * Get createDate.
1243
         *
1244
         * @return \DateTime
1245
         */
1246
        public function getCreateDate()
1247 11
        {
1248
            return $this->create_date;
1249 11
        }
1250
1251
        /**
1252
         * Set updateDate.
1253
         *
1254
         * @param \DateTime $updateDate
1255
         *
1256
         * @return Order
1257
         */
1258
        public function setUpdateDate($updateDate)
1259
        {
1260
            $this->update_date = $updateDate;
1261
1262
            return $this;
1263
        }
1264
1265
        /**
1266
         * Get updateDate.
1267
         *
1268
         * @return \DateTime
1269
         */
1270
        public function getUpdateDate()
1271
        {
1272
            return $this->update_date;
1273
        }
1274
1275
        /**
1276
         * Set orderDate.
1277
         *
1278
         * @param \DateTime|null $orderDate
1279
         *
1280
         * @return Order
1281 36
         */
1282
        public function setOrderDate($orderDate = null)
1283 36
        {
1284
            $this->order_date = $orderDate;
1285 36
1286
            return $this;
1287
        }
1288
1289
        /**
1290
         * Get orderDate.
1291
         *
1292
         * @return \DateTime|null
1293
         */
1294
        public function getOrderDate()
1295 282
        {
1296
            return $this->order_date;
1297 282
        }
1298
1299 282
        /**
1300
         * Set paymentDate.
1301
         *
1302
         * @param \DateTime|null $paymentDate
1303
         *
1304
         * @return Order
1305
         */
1306
        public function setPaymentDate($paymentDate = null)
1307
        {
1308
            $this->payment_date = $paymentDate;
1309 28
1310
            return $this;
1311 28
        }
1312
1313
        /**
1314
         * Get paymentDate.
1315
         *
1316
         * @return \DateTime|null
1317
         */
1318
        public function getPaymentDate()
1319 284
        {
1320
            return $this->payment_date;
1321 284
        }
1322
1323
        /**
1324
         * Get currencyCode.
1325
         *
1326
         * @return string
1327
         */
1328
        public function getCurrencyCode()
1329 273
        {
1330
            return $this->currency_code;
1331 273
        }
1332
1333
        /**
1334
         * Set currencyCode.
1335
         *
1336
         * @param string|null $currencyCode
1337
         *
1338
         * @return $this
1339
         */
1340
        public function setCurrencyCode($currencyCode = null)
1341 218
        {
1342
            $this->currency_code = $currencyCode;
1343 218
1344
            return $this;
1345 218
        }
1346
1347
        /**
1348
         * @return null|string
1349
         */
1350
        public function getCompleteMessage()
1351
        {
1352
            return $this->complete_message;
1353
        }
1354
1355 25
        /**
1356
         * @param null|string $complete_message
1357 25
         *
1358
         * @return $this
1359
         */
1360
        public function setCompleteMessage($complete_message = null)
1361
        {
1362
            $this->complete_message = $complete_message;
1363
1364
            return $this;
1365 115
        }
1366
1367 115
        /**
1368 115
         * @param null|string $complete_message
1369
         *
1370 115
         * @return $this
1371
         */
1372
        public function appendCompleteMessage($complete_message = null)
1373
        {
1374
            $this->complete_message .= $complete_message;
1375
1376
            return $this;
1377
        }
1378
1379
        /**
1380
         * @return null|string
1381
         */
1382
        public function getCompleteMailMessage()
1383
        {
1384
            return $this->complete_mail_message;
1385
        }
1386
1387
        /**
1388
         * @param null|string $complete_mail_message
1389
         *
1390
         * @return
1391
         */
1392
        public function setCompleteMailMessage($complete_mail_message = null)
1393
        {
1394
            $this->complete_mail_message = $complete_mail_message;
1395
1396
            return $this;
1397
        }
1398
1399
        /**
1400
         * @param null|string $complete_mail_message
1401
         *
1402
         * @return
1403
         */
1404 1
        public function appendCompleteMailMessage($complete_mail_message = null)
1405
        {
1406 1
            $this->complete_mail_message .= $complete_mail_message;
1407
1408
            return $this;
1409
        }
1410
1411
        /**
1412
         * 商品の受注明細を取得
1413
         *
1414
         * @return OrderItem[]
1415
         */
1416 246
        public function getProductOrderItems()
1417
        {
1418 246
            $sio = new OrderItemCollection($this->OrderItems->toArray());
1419
1420 246
            return array_values($sio->getProductClasses()->toArray());
1421
        }
1422
1423
        /**
1424
         * Add orderItem.
1425
         *
1426
         * @param \Eccube\Entity\OrderItem $OrderItem
1427
         *
1428 273
         * @return Order
1429
         */
1430 273
        public function addOrderItem(\Eccube\Entity\OrderItem $OrderItem)
1431
        {
1432
            $this->OrderItems[] = $OrderItem;
1433
1434
            return $this;
1435
        }
1436
1437
        /**
1438
         * Remove orderItem.
1439
         *
1440
         * @param \Eccube\Entity\OrderItem $OrderItem
1441
         *
1442
         * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
1443
         */
1444
        public function removeOrderItem(\Eccube\Entity\OrderItem $OrderItem)
1445
        {
1446
            return $this->OrderItems->removeElement($OrderItem);
1447
        }
1448
1449
        /**
1450
         * Get orderItems.
1451
         *
1452
         * @return \Doctrine\Common\Collections\Collection|OrderItem[]
1453
         */
1454
        public function getOrderItems()
1455
        {
1456
            return $this->OrderItems;
1457
        }
1458
1459
        /**
1460
         * Sorted to getOrderItems()
1461
         *
1462
         * @return ItemCollection
1463
         */
1464 167
        public function getItems()
1465
        {
1466 167
            return (new ItemCollection($this->getOrderItems()))->sort();
1467
        }
1468 167
1469
        /**
1470
         * Add shipping.
1471
         *
1472
         * @param \Eccube\Entity\Shipping $Shipping
1473
         *
1474
         * @return Order
1475
         */
1476 73
        public function addShipping(\Eccube\Entity\Shipping $Shipping)
1477
        {
1478 73
            $this->Shippings[] = $Shipping;
1479
1480
            return $this;
1481
        }
1482
1483
        /**
1484
         * Remove shipping.
1485
         *
1486
         * @param \Eccube\Entity\Shipping $Shipping
1487
         *
1488 6
         * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
1489
         */
1490 6
        public function removeShipping(\Eccube\Entity\Shipping $Shipping)
1491
        {
1492 6
            return $this->Shippings->removeElement($Shipping);
1493
        }
1494
1495
        /**
1496
         * Get shippings.
1497
         *
1498
         * @return \Doctrine\Common\Collections\Collection|\Eccube\Entity\Shipping[]
1499
         */
1500 3
        public function getShippings()
1501
        {
1502 3
            $criteria = Criteria::create()
1503
            ->orderBy(['name01' => Criteria::ASC, 'name02' => Criteria::ASC, 'id' => Criteria::ASC]);
1504
1505
            return $this->Shippings->matching($criteria);
0 ignored issues
show
Bug introduced by
It seems like you code against a concrete implementation and not the interface Doctrine\Common\Collections\Collection as the method matching() does only exist in the following implementations of said interface: Doctrine\Common\Collections\ArrayCollection, Doctrine\ORM\LazyCriteriaCollection, Doctrine\ORM\PersistentCollection, Eccube\Service\Calculator\OrderItemCollection, Eccube\Service\PurchaseFlow\ItemCollection.

Let’s take a look at an example:

interface User
{
    /** @return string */
    public function getPassword();
}

class MyUser implements User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the interface:

    interface User
    {
        /** @return string */
        public function getPassword();
    
        /** @return string */
        public function getDisplayName();
    }
    
Loading history...
1506
        }
1507
1508
        /**
1509
         * Add mailHistory.
1510
         *
1511
         * @param \Eccube\Entity\MailHistory $mailHistory
1512 5
         *
1513
         * @return Order
1514 5
         */
1515
        public function addMailHistory(\Eccube\Entity\MailHistory $mailHistory)
1516 5
        {
1517
            $this->MailHistories[] = $mailHistory;
1518
1519
            return $this;
1520
        }
1521
1522
        /**
1523
         * Remove mailHistory.
1524 3
         *
1525
         * @param \Eccube\Entity\MailHistory $mailHistory
1526 3
         *
1527
         * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
1528
         */
1529
        public function removeMailHistory(\Eccube\Entity\MailHistory $mailHistory)
1530
        {
1531
            return $this->MailHistories->removeElement($mailHistory);
1532
        }
1533
1534
        /**
1535
         * Get mailHistories.
1536 218
         *
1537
         * @return \Doctrine\Common\Collections\Collection
1538 218
         */
1539
        public function getMailHistories()
1540 218
        {
1541
            return $this->MailHistories;
1542
        }
1543
1544
        /**
1545
         * Set customer.
1546
         *
1547
         * @param \Eccube\Entity\Customer|null $customer
1548 218
         *
1549
         * @return Order
1550 218
         */
1551
        public function setCustomer(\Eccube\Entity\Customer $customer = null)
1552
        {
1553
            $this->Customer = $customer;
1554
1555
            return $this;
1556
        }
1557
1558
        /**
1559
         * Get customer.
1560 51
         *
1561
         * @return \Eccube\Entity\Customer|null
1562 51
         */
1563
        public function getCustomer()
1564 51
        {
1565
            return $this->Customer;
1566
        }
1567
1568
        /**
1569
         * Set country.
1570
         *
1571
         * @param \Eccube\Entity\Master\Country|null $country
1572 2
         *
1573
         * @return Order
1574 2
         */
1575
        public function setCountry(\Eccube\Entity\Master\Country $country = null)
1576
        {
1577
            $this->Country = $country;
1578
1579
            return $this;
1580
        }
1581
1582
        /**
1583
         * Get country.
1584
         *
1585
         * @return \Eccube\Entity\Master\Country|null
1586
         */
1587
        public function getCountry()
1588
        {
1589
            return $this->Country;
1590
        }
1591
1592
        /**
1593
         * Set pref.
1594
         *
1595
         * @param \Eccube\Entity\Master\Pref|null $pref
1596
         *
1597
         * @return Order
1598
         */
1599
        public function setPref(\Eccube\Entity\Master\Pref $pref = null)
1600
        {
1601
            $this->Pref = $pref;
1602
1603
            return $this;
1604
        }
1605
1606
        /**
1607
         * Get pref.
1608 356
         *
1609
         * @return \Eccube\Entity\Master\Pref|null
1610 356
         */
1611
        public function getPref()
1612 356
        {
1613
            return $this->Pref;
1614
        }
1615
1616
        /**
1617
         * Set sex.
1618
         *
1619
         * @param \Eccube\Entity\Master\Sex|null $sex
1620 237
         *
1621
         * @return Order
1622 237
         */
1623
        public function setSex(\Eccube\Entity\Master\Sex $sex = null)
1624
        {
1625
            $this->Sex = $sex;
1626
1627
            return $this;
1628 72
        }
1629
1630 72
        /**
1631
         * Get sex.
1632
         *
1633 1
         * @return \Eccube\Entity\Master\Sex|null
1634
         */
1635 1
        public function getSex()
1636 1
        {
1637 1
            return $this->Sex;
1638
        }
1639
1640 1
        /**
1641
         * Set job.
1642
         *
1643
         * @param \Eccube\Entity\Master\Job|null $job
1644
         *
1645
         * @return Order
1646
         */
1647
        public function setJob(\Eccube\Entity\Master\Job $job = null)
1648
        {
1649
            $this->Job = $job;
1650
1651
            return $this;
1652
        }
1653
1654
        /**
1655
         * Get job.
1656
         *
1657
         * @return \Eccube\Entity\Master\Job|null
1658
         */
1659
        public function getJob()
1660
        {
1661
            return $this->Job;
1662
        }
1663
1664
        /**
1665
         * Set payment.
1666
         *
1667
         * @param \Eccube\Entity\Payment|null $payment
1668
         *
1669
         * @return Order
1670
         */
1671
        public function setPayment(\Eccube\Entity\Payment $payment = null)
1672
        {
1673
            $this->Payment = $payment;
1674
1675
            return $this;
1676
        }
1677
1678
        /**
1679
         * Get payment.
1680
         *
1681
         * @return \Eccube\Entity\Payment|null
1682
         */
1683
        public function getPayment()
1684
        {
1685
            return $this->Payment;
1686
        }
1687
1688
        /**
1689
         * Set deviceType.
1690
         *
1691
         * @param \Eccube\Entity\Master\DeviceType|null $deviceType
1692
         *
1693
         * @return Order
1694
         */
1695
        public function setDeviceType(\Eccube\Entity\Master\DeviceType $deviceType = null)
1696
        {
1697
            $this->DeviceType = $deviceType;
1698
1699
            return $this;
1700
        }
1701
1702
        /**
1703
         * Get deviceType.
1704
         *
1705
         * @return \Eccube\Entity\Master\DeviceType|null
1706
         */
1707
        public function getDeviceType()
1708
        {
1709
            return $this->DeviceType;
1710
        }
1711
1712
        /**
1713
         * Set customerOrderStatus.
1714
         *
1715
         * @param \Eccube\Entity\Master\CustomerOrderStatus|null $customerOrderStatus
1716
         *
1717
         * @return Order
1718
         */
1719
        public function setCustomerOrderStatus(\Eccube\Entity\Master\CustomerOrderStatus $customerOrderStatus = null)
1720
        {
1721
            $this->CustomerOrderStatus = $customerOrderStatus;
1722
1723
            return $this;
1724
        }
1725
1726
        /**
1727
         * Get customerOrderStatus.
1728
         *
1729
         * @return \Eccube\Entity\Master\CustomerOrderStatus|null
1730
         */
1731
        public function getCustomerOrderStatus()
1732
        {
1733
            return $this->CustomerOrderStatus;
1734
        }
1735
1736
        /**
1737
         * Set orderStatusColor.
1738
         *
1739
         * @param \Eccube\Entity\Master\OrderStatusColor|null $orderStatusColor
1740
         *
1741
         * @return Order
1742
         */
1743
        public function setOrderStatusColor(\Eccube\Entity\Master\OrderStatusColor $orderStatusColor = null)
1744
        {
1745
            $this->OrderStatusColor = $orderStatusColor;
1746
1747
            return $this;
1748
        }
1749
1750
        /**
1751
         * Get orderStatusColor.
1752
         *
1753
         * @return \Eccube\Entity\Master\OrderStatusColor|null
1754
         */
1755
        public function getOrderStatusColor()
1756
        {
1757
            return $this->OrderStatusColor;
1758
        }
1759
1760
        /**
1761
         * Set orderStatus.
1762
         *
1763
         * @param \Eccube\Entity\Master\OrderStatus|null|object $orderStatus
1764
         *
1765
         * @return Order
1766
         */
1767
        public function setOrderStatus(\Eccube\Entity\Master\OrderStatus $orderStatus = null)
1768
        {
1769
            $this->OrderStatus = $orderStatus;
1770
1771
            return $this;
1772
        }
1773
1774
        /**
1775
         * Get orderStatus.
1776
         *
1777
         * @return \Eccube\Entity\Master\OrderStatus|null
1778
         */
1779
        public function getOrderStatus()
1780
        {
1781
            return $this->OrderStatus;
1782
        }
1783
1784
        /**
1785
         * @param ItemInterface $item
1786
         */
1787
        public function addItem(ItemInterface $item)
1788
        {
1789
            $this->OrderItems->add($item);
1790
        }
1791
1792
        public function getQuantity()
1793
        {
1794
            $quantity = 0;
1795
            foreach ($this->getItems() as $item) {
1796
                $quantity += $item->getQuantity();
1797
            }
1798
1799
            return $quantity;
1800
        }
1801
    }
1802
}
1803