app/proxy/entity/src/Eccube/Entity/Order.php line 44

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Eccube\Entity;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Criteria;
  15. use Doctrine\ORM\Mapping as ORM;
  16. use Eccube\Entity\Master\RoundingType;
  17. use Eccube\Entity\Master\TaxType;
  18. use Eccube\Service\Calculator\OrderItemCollection;
  19. use Eccube\Service\PurchaseFlow\ItemCollection;
  20. use Eccube\Service\TaxRuleService;
  21.     /**
  22.      * Order
  23.      *
  24.      * @ORM\Table(name="dtb_order", indexes={
  25.      *     @ORM\Index(name="dtb_order_email_idx", columns={"email"}),
  26.      *     @ORM\Index(name="dtb_order_order_date_idx", columns={"order_date"}),
  27.      *     @ORM\Index(name="dtb_order_payment_date_idx", columns={"payment_date"}),
  28.      *     @ORM\Index(name="dtb_order_update_date_idx", columns={"update_date"}),
  29.      *     @ORM\Index(name="dtb_order_order_no_idx", columns={"order_no"})
  30.      *  },
  31.      *  uniqueConstraints={
  32.      *     @ORM\UniqueConstraint(name="dtb_order_pre_order_id_idx", columns={"pre_order_id"})
  33.      *  })
  34.      * @ORM\InheritanceType("SINGLE_TABLE")
  35.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  36.      * @ORM\HasLifecycleCallbacks()
  37.      * @ORM\Entity(repositoryClass="Eccube\Repository\OrderRepository")
  38.      */
  39.     class Order extends \Eccube\Entity\AbstractEntity implements PurchaseInterfaceItemHolderInterface
  40.     {
  41.         use NameTrait, \Plugin\EccubePaymentLite42\Entity\OrderTrait, \Plugin\CustomerRank42\Entity\OrderTrait;
  42.         use PointTrait;
  43.         /**
  44.          * 課税対象の明細を返す.
  45.          *
  46.          * @return OrderItem[]
  47.          */
  48.         public function getTaxableItems()
  49.         {
  50.             $Items = [];
  51.             foreach ($this->OrderItems as $Item) {
  52.                 if (null === $Item->getTaxType()) {
  53.                     continue;
  54.                 }
  55.                 if ($Item->getTaxType()->getId() == TaxType::TAXATION) {
  56.                     $Items[] = $Item;
  57.                 }
  58.             }
  59.             return $Items;
  60.         }
  61.         /**
  62.          * 課税対象の明細の合計金額を返す.
  63.          * 商品合計 + 送料 + 手数料 + 値引き(課税).
  64.          */
  65.         public function getTaxableTotal()
  66.         {
  67.             $total 0;
  68.             foreach ($this->getTaxableItems() as $Item) {
  69.                 $total += $Item->getTotalPrice();
  70.             }
  71.             return $total;
  72.         }
  73.         /**
  74.          * 課税対象の明細の合計金額を、税率ごとに集計する.
  75.          *
  76.          * @return array
  77.          */
  78.         public function getTaxableTotalByTaxRate()
  79.         {
  80.             $total = [];
  81.             foreach ($this->getTaxableItems() as $Item) {
  82.                 $totalPrice $Item->getTotalPrice();
  83.                 $taxRate $Item->getTaxRate();
  84.                 $total[$taxRate] = isset($total[$taxRate])
  85.                     ? $total[$taxRate] + $totalPrice
  86.                     $totalPrice;
  87.             }
  88.             krsort($total);
  89.             return $total;
  90.         }
  91.         /**
  92.          * 明細の合計額を税率ごとに集計する.
  93.          *
  94.          * 不課税, 非課税の値引明細は税率ごとに按分する.
  95.          *
  96.          * @return int[]
  97.          */
  98.         public function getTotalByTaxRate()
  99.         {
  100.             $roundingTypes $this->getRoundingTypeByTaxRate();
  101.             $total = [];
  102.             foreach ($this->getTaxableTotalByTaxRate() as $rate => $totalPrice) {
  103.                 $total[$rate] = TaxRuleService::roundByRoundingType(
  104.                     $this->getTaxableTotal() ?
  105.                         $totalPrice abs($this->getTaxFreeDiscount()) * $totalPrice $this->getTaxableTotal() : 0,
  106.                     $roundingTypes[$rate]->getId()
  107.                 );
  108.             }
  109.             ksort($total);
  110.             return $total;
  111.         }
  112.         /**
  113.          * 税額を税率ごとに集計する.
  114.          *
  115.          * 不課税, 非課税の値引明細は税率ごとに按分する.
  116.          *
  117.          * @return int[]
  118.          */
  119.         public function getTaxByTaxRate()
  120.         {
  121.             $roundingTypes $this->getRoundingTypeByTaxRate();
  122.             $tax = [];
  123.             foreach ($this->getTaxableTotalByTaxRate() as $rate => $totalPrice) {
  124.                 $tax[$rate] = TaxRuleService::roundByRoundingType(
  125.                     $this->getTaxableTotal() ?
  126.                         ($totalPrice abs($this->getTaxFreeDiscount()) * $totalPrice $this->getTaxableTotal()) * ($rate / (100 $rate)) : 0,
  127.                     $roundingTypes[$rate]->getId()
  128.                 );
  129.             }
  130.             ksort($tax);
  131.             return $tax;
  132.         }
  133.         /**
  134.          * 課税対象の値引き明細を返す.
  135.          *
  136.          * @return array
  137.          */
  138.         public function getTaxableDiscountItems()
  139.         {
  140.             $items = (new ItemCollection($this->getTaxableItems()))->sort()->toArray();
  141.             return array_filter($items, function (OrderItem $Item) {
  142.                 return $Item->isDiscount();
  143.             });
  144.         }
  145.         /**
  146.          * 課税対象の値引き金額合計を返す.
  147.          *
  148.          * @return mixed
  149.          */
  150.         public function getTaxableDiscount()
  151.         {
  152.             return array_reduce($this->getTaxableDiscountItems(), function ($sumOrderItem $Item) {
  153.                 return $sum += $Item->getTotalPrice();
  154.             }, 0);
  155.         }
  156.         /**
  157.          * 非課税・不課税の値引き明細を返す.
  158.          *
  159.          * @return array
  160.          */
  161.         public function getTaxFreeDiscountItems()
  162.         {
  163.             $items = (new ItemCollection($this->getOrderItems()))->sort()->toArray();
  164.             return array_filter($items, function (OrderItem $Item) {
  165.                 return $Item->isPoint() || ($Item->isDiscount() && $Item->getTaxType()->getId() != TaxType::TAXATION);
  166.             });
  167.         }
  168.         /**
  169.          * 非課税・不課税の値引き額を返す.
  170.          *
  171.          * @return int|float
  172.          */
  173.         public function getTaxFreeDiscount()
  174.         {
  175.             return array_reduce($this->getTaxFreeDiscountItems(), function ($sumOrderItem $Item) {
  176.                 return $sum += $Item->getTotalPrice();
  177.             }, 0);
  178.         }
  179.         /**
  180.          * 税率ごとの丸め規則を取得する.
  181.          *
  182.          * @return array<string, RoundingType>
  183.          */
  184.         public function getRoundingTypeByTaxRate()
  185.         {
  186.             $roundingTypes = [];
  187.             foreach ($this->getTaxableItems() as $Item) {
  188.                 $roundingTypes[$Item->getTaxRate()] = $Item->getRoundingType();
  189.             }
  190.             return $roundingTypes;
  191.         }
  192.         /**
  193.          * 複数配送かどうかの判定を行う.
  194.          *
  195.          * @return boolean
  196.          */
  197.         public function isMultiple()
  198.         {
  199.             $Shippings = [];
  200.             // クエリビルダ使用時に絞り込まれる場合があるため,
  201.             // getShippingsではなくOrderItem経由でShippingを取得する.
  202.             foreach ($this->getOrderItems() as $OrderItem) {
  203.                 if ($Shipping $OrderItem->getShipping()) {
  204.                     $id $Shipping->getId();
  205.                     if (isset($Shippings[$id])) {
  206.                         continue;
  207.                     }
  208.                     $Shippings[$id] = $Shipping;
  209.                 }
  210.             }
  211.             return count($Shippings) > true false;
  212.         }
  213.         /**
  214.          * 対象となるお届け先情報を取得
  215.          *
  216.          * @param integer $shippingId
  217.          *
  218.          * @return \Eccube\Entity\Shipping|null
  219.          */
  220.         public function findShipping($shippingId)
  221.         {
  222.             foreach ($this->getShippings() as $Shipping) {
  223.                 if ($Shipping->getId() == $shippingId) {
  224.                     return $Shipping;
  225.                 }
  226.             }
  227.             return null;
  228.         }
  229.         /**
  230.          * この注文の保持する販売種別を取得します.
  231.          *
  232.          * @return \Eccube\Entity\Master\SaleType[] 一意な販売種別の配列
  233.          */
  234.         public function getSaleTypes()
  235.         {
  236.             $saleTypes = [];
  237.             foreach ($this->getOrderItems() as $OrderItem) {
  238.                 /* @var $ProductClass \Eccube\Entity\ProductClass */
  239.                 $ProductClass $OrderItem->getProductClass();
  240.                 if ($ProductClass) {
  241.                     $saleTypes[] = $ProductClass->getSaleType();
  242.                 }
  243.             }
  244.             return array_unique($saleTypes);
  245.         }
  246.         /**
  247.          * 同じ規格の商品の個数をまとめた受注明細を取得
  248.          *
  249.          * @return OrderItem[]
  250.          */
  251.         public function getMergedProductOrderItems()
  252.         {
  253.             $ProductOrderItems $this->getProductOrderItems();
  254.             $orderItemArray = [];
  255.             /** @var OrderItem $ProductOrderItem */
  256.             foreach ($ProductOrderItems as $ProductOrderItem) {
  257.                 $productClassId $ProductOrderItem->getProductClass()->getId();
  258.                 if (array_key_exists($productClassId$orderItemArray)) {
  259.                     // 同じ規格の商品がある場合は個数をまとめる
  260.                     /** @var ItemInterface $OrderItem */
  261.                     $OrderItem $orderItemArray[$productClassId];
  262.                     $quantity $OrderItem->getQuantity() + $ProductOrderItem->getQuantity();
  263.                     $OrderItem->setQuantity($quantity);
  264.                 } else {
  265.                     // 新規規格の商品は新しく追加する
  266.                     $OrderItem = new OrderItem();
  267.                     $OrderItem->copyProperties($ProductOrderItem, ['id']);
  268.                     $orderItemArray[$productClassId] = $OrderItem;
  269.                 }
  270.             }
  271.             return array_values($orderItemArray);
  272.         }
  273.         /**
  274.          * 合計金額を計算
  275.          *
  276.          * @return string
  277.          *
  278.          * @deprecated
  279.          */
  280.         public function getTotalPrice()
  281.         {
  282.             @trigger_error('The ' __METHOD__ ' method is deprecated.'E_USER_DEPRECATED);
  283.             return $this->getPaymentTotal();
  284.         }
  285.         /**
  286.          * @var integer
  287.          *
  288.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  289.          * @ORM\Id
  290.          * @ORM\GeneratedValue(strategy="IDENTITY")
  291.          */
  292.         private $id;
  293.         /**
  294.          * @var string|null
  295.          *
  296.          * @ORM\Column(name="pre_order_id", type="string", length=255, nullable=true)
  297.          */
  298.         private $pre_order_id;
  299.         /**
  300.          * @var string|null
  301.          *
  302.          * @ORM\Column(name="order_no", type="string", length=255, nullable=true)
  303.          */
  304.         private $order_no;
  305.         /**
  306.          * @var string|null
  307.          *
  308.          * @ORM\Column(name="message", type="string", length=4000, nullable=true)
  309.          */
  310.         private $message;
  311.         /**
  312.          * @var string|null
  313.          *
  314.          * @ORM\Column(name="name01", type="string", length=255)
  315.          */
  316.         private $name01;
  317.         /**
  318.          * @var string|null
  319.          *
  320.          * @ORM\Column(name="name02", type="string", length=255)
  321.          */
  322.         private $name02;
  323.         /**
  324.          * @var string|null
  325.          *
  326.          * @ORM\Column(name="kana01", type="string", length=255, nullable=true)
  327.          */
  328.         private $kana01;
  329.         /**
  330.          * @var string|null
  331.          *
  332.          * @ORM\Column(name="kana02", type="string", length=255, nullable=true)
  333.          */
  334.         private $kana02;
  335.         /**
  336.          * @var string|null
  337.          *
  338.          * @ORM\Column(name="company_name", type="string", length=255, nullable=true)
  339.          */
  340.         private $company_name;
  341.         /**
  342.          * @var string|null
  343.          *
  344.          * @ORM\Column(name="email", type="string", length=255, nullable=true)
  345.          */
  346.         private $email;
  347.         /**
  348.          * @var string|null
  349.          *
  350.          * @ORM\Column(name="phone_number", type="string", length=14, nullable=true)
  351.          */
  352.         private $phone_number;
  353.         /**
  354.          * @var string|null
  355.          *
  356.          * @ORM\Column(name="postal_code", type="string", length=8, nullable=true)
  357.          */
  358.         private $postal_code;
  359.         /**
  360.          * @var string|null
  361.          *
  362.          * @ORM\Column(name="addr01", type="string", length=255, nullable=true)
  363.          */
  364.         private $addr01;
  365.         /**
  366.          * @var string|null
  367.          *
  368.          * @ORM\Column(name="addr02", type="string", length=255, nullable=true)
  369.          */
  370.         private $addr02;
  371.         /**
  372.          * @var \DateTime|null
  373.          *
  374.          * @ORM\Column(name="birth", type="datetimetz", nullable=true)
  375.          */
  376.         private $birth;
  377.         /**
  378.          * @var string
  379.          *
  380.          * @ORM\Column(name="subtotal", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
  381.          */
  382.         private $subtotal 0;
  383.         /**
  384.          * @var string
  385.          *
  386.          * @ORM\Column(name="discount", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
  387.          */
  388.         private $discount 0;
  389.         /**
  390.          * @var string
  391.          *
  392.          * @ORM\Column(name="delivery_fee_total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
  393.          */
  394.         private $delivery_fee_total 0;
  395.         /**
  396.          * @var string
  397.          *
  398.          * @ORM\Column(name="charge", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
  399.          */
  400.         private $charge 0;
  401.         /**
  402.          * @var string
  403.          *
  404.          * @ORM\Column(name="tax", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
  405.          *
  406.          * @deprecated 明細ごとに集計した税額と差異が発生する場合があるため非推奨
  407.          */
  408.         private $tax 0;
  409.         /**
  410.          * @var string
  411.          *
  412.          * @ORM\Column(name="total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
  413.          */
  414.         private $total 0;
  415.         /**
  416.          * @var string
  417.          *
  418.          * @ORM\Column(name="payment_total", type="decimal", precision=12, scale=2, options={"unsigned":true,"default":0})
  419.          */
  420.         private $payment_total 0;
  421.         /**
  422.          * @var string|null
  423.          *
  424.          * @ORM\Column(name="payment_method", type="string", length=255, nullable=true)
  425.          */
  426.         private $payment_method;
  427.         /**
  428.          * @var string|null
  429.          *
  430.          * @ORM\Column(name="note", type="string", length=4000, nullable=true)
  431.          */
  432.         private $note;
  433.         /**
  434.          * @var \DateTime
  435.          *
  436.          * @ORM\Column(name="create_date", type="datetimetz")
  437.          */
  438.         private $create_date;
  439.         /**
  440.          * @var \DateTime
  441.          *
  442.          * @ORM\Column(name="update_date", type="datetimetz")
  443.          */
  444.         private $update_date;
  445.         /**
  446.          * @var \DateTime|null
  447.          *
  448.          * @ORM\Column(name="order_date", type="datetimetz", nullable=true)
  449.          */
  450.         private $order_date;
  451.         /**
  452.          * @var \DateTime|null
  453.          *
  454.          * @ORM\Column(name="payment_date", type="datetimetz", nullable=true)
  455.          */
  456.         private $payment_date;
  457.         /**
  458.          * @var string|null
  459.          *
  460.          * @ORM\Column(name="currency_code", type="string", nullable=true)
  461.          */
  462.         private $currency_code;
  463.         /**
  464.          * 注文完了画面に表示するメッセージ
  465.          *
  466.          * プラグインから注文完了時にメッセージを表示したい場合, このフィールドにセットすることで, 注文完了画面で表示されます。
  467.          * 複数のプラグインから利用されるため, appendCompleteMesssage()で追加してください.
  468.          * 表示する際にHTMLは利用可能です。
  469.          *
  470.          * @var string|null
  471.          *
  472.          * @ORM\Column(name="complete_message", type="text", nullable=true)
  473.          */
  474.         private $complete_message;
  475.         /**
  476.          * 注文完了メールに表示するメッセージ
  477.          *
  478.          * プラグインから注文完了メールにメッセージを表示したい場合, このフィールドにセットすることで, 注文完了メールで表示されます。
  479.          * 複数のプラグインから利用されるため, appendCompleteMailMesssage()で追加してください.
  480.          *
  481.          * @var string|null
  482.          *
  483.          * @ORM\Column(name="complete_mail_message", type="text", nullable=true)
  484.          */
  485.         private $complete_mail_message;
  486.         /**
  487.          * @var \Doctrine\Common\Collections\Collection|OrderItem[]
  488.          *
  489.          * @ORM\OneToMany(targetEntity="Eccube\Entity\OrderItem", mappedBy="Order", cascade={"persist","remove"})
  490.          */
  491.         private $OrderItems;
  492.         /**
  493.          * @var \Doctrine\Common\Collections\Collection|Shipping[]
  494.          *
  495.          * @ORM\OneToMany(targetEntity="Eccube\Entity\Shipping", mappedBy="Order", cascade={"persist","remove"})
  496.          */
  497.         private $Shippings;
  498.         /**
  499.          * @var \Doctrine\Common\Collections\Collection
  500.          *
  501.          * @ORM\OneToMany(targetEntity="Eccube\Entity\MailHistory", mappedBy="Order", cascade={"remove"})
  502.          * @ORM\OrderBy({
  503.          *     "send_date"="DESC"
  504.          * })
  505.          */
  506.         private $MailHistories;
  507.         /**
  508.          * @var \Eccube\Entity\Customer
  509.          *
  510.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Customer", inversedBy="Orders")
  511.          * @ORM\JoinColumns({
  512.          *   @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
  513.          * })
  514.          */
  515.         private $Customer;
  516.         /**
  517.          * @var \Eccube\Entity\Master\Country
  518.          *
  519.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Country")
  520.          * @ORM\JoinColumns({
  521.          *   @ORM\JoinColumn(name="country_id", referencedColumnName="id")
  522.          * })
  523.          */
  524.         private $Country;
  525.         /**
  526.          * @var \Eccube\Entity\Master\Pref
  527.          *
  528.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Pref")
  529.          * @ORM\JoinColumns({
  530.          *   @ORM\JoinColumn(name="pref_id", referencedColumnName="id")
  531.          * })
  532.          */
  533.         private $Pref;
  534.         /**
  535.          * @var \Eccube\Entity\Master\Sex
  536.          *
  537.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Sex")
  538.          * @ORM\JoinColumns({
  539.          *   @ORM\JoinColumn(name="sex_id", referencedColumnName="id")
  540.          * })
  541.          */
  542.         private $Sex;
  543.         /**
  544.          * @var \Eccube\Entity\Master\Job
  545.          *
  546.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\Job")
  547.          * @ORM\JoinColumns({
  548.          *   @ORM\JoinColumn(name="job_id", referencedColumnName="id")
  549.          * })
  550.          */
  551.         private $Job;
  552.         /**
  553.          * @var \Eccube\Entity\Payment
  554.          *
  555.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Payment")
  556.          * @ORM\JoinColumns({
  557.          *   @ORM\JoinColumn(name="payment_id", referencedColumnName="id")
  558.          * })
  559.          */
  560.         private $Payment;
  561.         /**
  562.          * @var \Eccube\Entity\Master\DeviceType
  563.          *
  564.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\DeviceType")
  565.          * @ORM\JoinColumns({
  566.          *   @ORM\JoinColumn(name="device_type_id", referencedColumnName="id")
  567.          * })
  568.          */
  569.         private $DeviceType;
  570.         /**
  571.          * OrderStatusより先にプロパティを定義しておかないとセットされなくなる
  572.          *
  573.          * @var \Eccube\Entity\Master\CustomerOrderStatus
  574.          *
  575.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\CustomerOrderStatus")
  576.          * @ORM\JoinColumns({
  577.          *   @ORM\JoinColumn(name="order_status_id", referencedColumnName="id")
  578.          * })
  579.          */
  580.         private $CustomerOrderStatus;
  581.         /**
  582.          * OrderStatusより先にプロパティを定義しておかないとセットされなくなる
  583.          *
  584.          * @var \Eccube\Entity\Master\OrderStatusColor
  585.          *
  586.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\OrderStatusColor")
  587.          * @ORM\JoinColumns({
  588.          *   @ORM\JoinColumn(name="order_status_id", referencedColumnName="id")
  589.          * })
  590.          */
  591.         private $OrderStatusColor;
  592.         /**
  593.          * @var \Eccube\Entity\Master\OrderStatus
  594.          *
  595.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\OrderStatus")
  596.          * @ORM\JoinColumns({
  597.          *   @ORM\JoinColumn(name="order_status_id", referencedColumnName="id")
  598.          * })
  599.          */
  600.         private $OrderStatus;
  601.         /**
  602.          * Constructor
  603.          */
  604.         public function __construct(Master\OrderStatus $orderStatus null)
  605.         {
  606.             $this->setDiscount(0)
  607.                 ->setSubtotal(0)
  608.                 ->setTotal(0)
  609.                 ->setPaymentTotal(0)
  610.                 ->setCharge(0)
  611.                 ->setTax(0)
  612.                 ->setDeliveryFeeTotal(0)
  613.                 ->setOrderStatus($orderStatus);
  614.             $this->OrderItems = new \Doctrine\Common\Collections\ArrayCollection();
  615.             $this->Shippings = new \Doctrine\Common\Collections\ArrayCollection();
  616.             $this->MailHistories = new \Doctrine\Common\Collections\ArrayCollection();
  617.         }
  618.         /**
  619.          * Clone
  620.          */
  621.         public function __clone()
  622.         {
  623.             $OriginOrderItems $this->OrderItems;
  624.             $OrderItems = new ArrayCollection();
  625.             foreach ($this->OrderItems as $OrderItem) {
  626.                 $OrderItems->add(clone $OrderItem);
  627.             }
  628.             $this->OrderItems $OrderItems;
  629. //            // ShippingとOrderItemが循環参照するため, 手動でヒモ付を変更する.
  630. //            $Shippings = new ArrayCollection();
  631. //            foreach ($this->Shippings as $Shipping) {
  632. //                $CloneShipping = clone $Shipping;
  633. //                foreach ($OriginOrderItems as $OrderItem) {
  634. //                    //$CloneShipping->removeOrderItem($OrderItem);
  635. //                }
  636. //                foreach ($this->OrderItems as $OrderItem) {
  637. //                    if ($OrderItem->getShipping() && $OrderItem->getShipping()->getId() == $Shipping->getId()) {
  638. //                        $OrderItem->setShipping($CloneShipping);
  639. //                    }
  640. //                    $CloneShipping->addOrderItem($OrderItem);
  641. //                }
  642. //                $Shippings->add($CloneShipping);
  643. //            }
  644. //            $this->Shippings = $Shippings;
  645.         }
  646.         /**
  647.          * Get id.
  648.          *
  649.          * @return int
  650.          */
  651.         public function getId()
  652.         {
  653.             return $this->id;
  654.         }
  655.         /**
  656.          * Set preOrderId.
  657.          *
  658.          * @param string|null $preOrderId
  659.          *
  660.          * @return Order
  661.          */
  662.         public function setPreOrderId($preOrderId null)
  663.         {
  664.             $this->pre_order_id $preOrderId;
  665.             return $this;
  666.         }
  667.         /**
  668.          * Get preOrderId.
  669.          *
  670.          * @return string|null
  671.          */
  672.         public function getPreOrderId()
  673.         {
  674.             return $this->pre_order_id;
  675.         }
  676.         /**
  677.          * Set orderNo
  678.          *
  679.          * @param string|null $orderNo
  680.          *
  681.          * @return Order
  682.          */
  683.         public function setOrderNo($orderNo null)
  684.         {
  685.             $this->order_no $orderNo;
  686.             return $this;
  687.         }
  688.         /**
  689.          * Get orderNo
  690.          *
  691.          * @return string|null
  692.          */
  693.         public function getOrderNo()
  694.         {
  695.             return $this->order_no;
  696.         }
  697.         /**
  698.          * Set message.
  699.          *
  700.          * @param string|null $message
  701.          *
  702.          * @return Order
  703.          */
  704.         public function setMessage($message null)
  705.         {
  706.             $this->message $message;
  707.             return $this;
  708.         }
  709.         /**
  710.          * Get message.
  711.          *
  712.          * @return string|null
  713.          */
  714.         public function getMessage()
  715.         {
  716.             return $this->message;
  717.         }
  718.         /**
  719.          * Set name01.
  720.          *
  721.          * @param string|null $name01
  722.          *
  723.          * @return Order
  724.          */
  725.         public function setName01($name01 null)
  726.         {
  727.             $this->name01 $name01;
  728.             return $this;
  729.         }
  730.         /**
  731.          * Get name01.
  732.          *
  733.          * @return string|null
  734.          */
  735.         public function getName01()
  736.         {
  737.             return $this->name01;
  738.         }
  739.         /**
  740.          * Set name02.
  741.          *
  742.          * @param string|null $name02
  743.          *
  744.          * @return Order
  745.          */
  746.         public function setName02($name02 null)
  747.         {
  748.             $this->name02 $name02;
  749.             return $this;
  750.         }
  751.         /**
  752.          * Get name02.
  753.          *
  754.          * @return string|null
  755.          */
  756.         public function getName02()
  757.         {
  758.             return $this->name02;
  759.         }
  760.         /**
  761.          * Set kana01.
  762.          *
  763.          * @param string|null $kana01
  764.          *
  765.          * @return Order
  766.          */
  767.         public function setKana01($kana01 null)
  768.         {
  769.             $this->kana01 $kana01;
  770.             return $this;
  771.         }
  772.         /**
  773.          * Get kana01.
  774.          *
  775.          * @return string|null
  776.          */
  777.         public function getKana01()
  778.         {
  779.             return $this->kana01;
  780.         }
  781.         /**
  782.          * Set kana02.
  783.          *
  784.          * @param string|null $kana02
  785.          *
  786.          * @return Order
  787.          */
  788.         public function setKana02($kana02 null)
  789.         {
  790.             $this->kana02 $kana02;
  791.             return $this;
  792.         }
  793.         /**
  794.          * Get kana02.
  795.          *
  796.          * @return string|null
  797.          */
  798.         public function getKana02()
  799.         {
  800.             return $this->kana02;
  801.         }
  802.         /**
  803.          * Set companyName.
  804.          *
  805.          * @param string|null $companyName
  806.          *
  807.          * @return Order
  808.          */
  809.         public function setCompanyName($companyName null)
  810.         {
  811.             $this->company_name $companyName;
  812.             return $this;
  813.         }
  814.         /**
  815.          * Get companyName.
  816.          *
  817.          * @return string|null
  818.          */
  819.         public function getCompanyName()
  820.         {
  821.             return $this->company_name;
  822.         }
  823.         /**
  824.          * Set email.
  825.          *
  826.          * @param string|null $email
  827.          *
  828.          * @return Order
  829.          */
  830.         public function setEmail($email null)
  831.         {
  832.             $this->email $email;
  833.             return $this;
  834.         }
  835.         /**
  836.          * Get email.
  837.          *
  838.          * @return string|null
  839.          */
  840.         public function getEmail()
  841.         {
  842.             return $this->email;
  843.         }
  844.         /**
  845.          * Set phone_number.
  846.          *
  847.          * @param string|null $phone_number
  848.          *
  849.          * @return Order
  850.          */
  851.         public function setPhoneNumber($phone_number null)
  852.         {
  853.             $this->phone_number $phone_number;
  854.             return $this;
  855.         }
  856.         /**
  857.          * Get phone_number.
  858.          *
  859.          * @return string|null
  860.          */
  861.         public function getPhoneNumber()
  862.         {
  863.             return $this->phone_number;
  864.         }
  865.         /**
  866.          * Set postal_code.
  867.          *
  868.          * @param string|null $postal_code
  869.          *
  870.          * @return Order
  871.          */
  872.         public function setPostalCode($postal_code null)
  873.         {
  874.             $this->postal_code $postal_code;
  875.             return $this;
  876.         }
  877.         /**
  878.          * Get postal_code.
  879.          *
  880.          * @return string|null
  881.          */
  882.         public function getPostalCode()
  883.         {
  884.             return $this->postal_code;
  885.         }
  886.         /**
  887.          * Set addr01.
  888.          *
  889.          * @param string|null $addr01
  890.          *
  891.          * @return Order
  892.          */
  893.         public function setAddr01($addr01 null)
  894.         {
  895.             $this->addr01 $addr01;
  896.             return $this;
  897.         }
  898.         /**
  899.          * Get addr01.
  900.          *
  901.          * @return string|null
  902.          */
  903.         public function getAddr01()
  904.         {
  905.             return $this->addr01;
  906.         }
  907.         /**
  908.          * Set addr02.
  909.          *
  910.          * @param string|null $addr02
  911.          *
  912.          * @return Order
  913.          */
  914.         public function setAddr02($addr02 null)
  915.         {
  916.             $this->addr02 $addr02;
  917.             return $this;
  918.         }
  919.         /**
  920.          * Get addr02.
  921.          *
  922.          * @return string|null
  923.          */
  924.         public function getAddr02()
  925.         {
  926.             return $this->addr02;
  927.         }
  928.         /**
  929.          * Set birth.
  930.          *
  931.          * @param \DateTime|null $birth
  932.          *
  933.          * @return Order
  934.          */
  935.         public function setBirth($birth null)
  936.         {
  937.             $this->birth $birth;
  938.             return $this;
  939.         }
  940.         /**
  941.          * Get birth.
  942.          *
  943.          * @return \DateTime|null
  944.          */
  945.         public function getBirth()
  946.         {
  947.             return $this->birth;
  948.         }
  949.         /**
  950.          * Set subtotal.
  951.          *
  952.          * @param string $subtotal
  953.          *
  954.          * @return Order
  955.          */
  956.         public function setSubtotal($subtotal)
  957.         {
  958.             $this->subtotal $subtotal;
  959.             return $this;
  960.         }
  961.         /**
  962.          * Get subtotal.
  963.          *
  964.          * @return string
  965.          */
  966.         public function getSubtotal()
  967.         {
  968.             return $this->subtotal;
  969.         }
  970.         /**
  971.          * Set discount.
  972.          *
  973.          * @param string $discount
  974.          *
  975.          * @return Order
  976.          */
  977.         public function setDiscount($discount)
  978.         {
  979.             $this->discount $discount;
  980.             return $this;
  981.         }
  982.         /**
  983.          * Get discount.
  984.          *
  985.          * @return string
  986.          * @deprecated 4.0.3 から値引きは課税値引きと 非課税・不課税の値引きの2種に分かれる. 課税値引きについてはgetTaxableDiscountを利用してください.
  987.          *
  988.          */
  989.         public function getDiscount()
  990.         {
  991.             return $this->discount;
  992.         }
  993.         /**
  994.          * Set deliveryFeeTotal.
  995.          *
  996.          * @param string $deliveryFeeTotal
  997.          *
  998.          * @return Order
  999.          */
  1000.         public function setDeliveryFeeTotal($deliveryFeeTotal)
  1001.         {
  1002.             $this->delivery_fee_total $deliveryFeeTotal;
  1003.             return $this;
  1004.         }
  1005.         /**
  1006.          * Get deliveryFeeTotal.
  1007.          *
  1008.          * @return string
  1009.          */
  1010.         public function getDeliveryFeeTotal()
  1011.         {
  1012.             return $this->delivery_fee_total;
  1013.         }
  1014.         /**
  1015.          * Set charge.
  1016.          *
  1017.          * @param string $charge
  1018.          *
  1019.          * @return Order
  1020.          */
  1021.         public function setCharge($charge)
  1022.         {
  1023.             $this->charge $charge;
  1024.             return $this;
  1025.         }
  1026.         /**
  1027.          * Get charge.
  1028.          *
  1029.          * @return string
  1030.          */
  1031.         public function getCharge()
  1032.         {
  1033.             return $this->charge;
  1034.         }
  1035.         /**
  1036.          * Set tax.
  1037.          *
  1038.          * @param string $tax
  1039.          *
  1040.          * @return Order
  1041.          *
  1042.          * @deprecated 明細ごとに集計した税額と差異が発生する場合があるため非推奨
  1043.          */
  1044.         public function setTax($tax)
  1045.         {
  1046.             $this->tax $tax;
  1047.             return $this;
  1048.         }
  1049.         /**
  1050.          * Get tax.
  1051.          *
  1052.          * @return string
  1053.          *
  1054.          * @deprecated 明細ごとに集計した税額と差異が発生する場合があるため非推奨
  1055.          */
  1056.         public function getTax()
  1057.         {
  1058.             return $this->tax;
  1059.         }
  1060.         /**
  1061.          * Set total.
  1062.          *
  1063.          * @param string $total
  1064.          *
  1065.          * @return Order
  1066.          */
  1067.         public function setTotal($total)
  1068.         {
  1069.             $this->total $total;
  1070.             return $this;
  1071.         }
  1072.         /**
  1073.          * Get total.
  1074.          *
  1075.          * @return string
  1076.          */
  1077.         public function getTotal()
  1078.         {
  1079.             return $this->total;
  1080.         }
  1081.         /**
  1082.          * Set paymentTotal.
  1083.          *
  1084.          * @param string $paymentTotal
  1085.          *
  1086.          * @return Order
  1087.          */
  1088.         public function setPaymentTotal($paymentTotal)
  1089.         {
  1090.             $this->payment_total $paymentTotal;
  1091.             return $this;
  1092.         }
  1093.         /**
  1094.          * Get paymentTotal.
  1095.          *
  1096.          * @return string
  1097.          */
  1098.         public function getPaymentTotal()
  1099.         {
  1100.             return $this->payment_total;
  1101.         }
  1102.         /**
  1103.          * Set paymentMethod.
  1104.          *
  1105.          * @param string|null $paymentMethod
  1106.          *
  1107.          * @return Order
  1108.          */
  1109.         public function setPaymentMethod($paymentMethod null)
  1110.         {
  1111.             $this->payment_method $paymentMethod;
  1112.             return $this;
  1113.         }
  1114.         /**
  1115.          * Get paymentMethod.
  1116.          *
  1117.          * @return string|null
  1118.          */
  1119.         public function getPaymentMethod()
  1120.         {
  1121.             return $this->payment_method;
  1122.         }
  1123.         /**
  1124.          * Set note.
  1125.          *
  1126.          * @param string|null $note
  1127.          *
  1128.          * @return Order
  1129.          */
  1130.         public function setNote($note null)
  1131.         {
  1132.             $this->note $note;
  1133.             return $this;
  1134.         }
  1135.         /**
  1136.          * Get note.
  1137.          *
  1138.          * @return string|null
  1139.          */
  1140.         public function getNote()
  1141.         {
  1142.             return $this->note;
  1143.         }
  1144.         /**
  1145.          * Set createDate.
  1146.          *
  1147.          * @param \DateTime $createDate
  1148.          *
  1149.          * @return Order
  1150.          */
  1151.         public function setCreateDate($createDate)
  1152.         {
  1153.             $this->create_date $createDate;
  1154.             return $this;
  1155.         }
  1156.         /**
  1157.          * Get createDate.
  1158.          *
  1159.          * @return \DateTime
  1160.          */
  1161.         public function getCreateDate()
  1162.         {
  1163.             return $this->create_date;
  1164.         }
  1165.         /**
  1166.          * Set updateDate.
  1167.          *
  1168.          * @param \DateTime $updateDate
  1169.          *
  1170.          * @return Order
  1171.          */
  1172.         public function setUpdateDate($updateDate)
  1173.         {
  1174.             $this->update_date $updateDate;
  1175.             return $this;
  1176.         }
  1177.         /**
  1178.          * Get updateDate.
  1179.          *
  1180.          * @return \DateTime
  1181.          */
  1182.         public function getUpdateDate()
  1183.         {
  1184.             return $this->update_date;
  1185.         }
  1186.         /**
  1187.          * Set orderDate.
  1188.          *
  1189.          * @param \DateTime|null $orderDate
  1190.          *
  1191.          * @return Order
  1192.          */
  1193.         public function setOrderDate($orderDate null)
  1194.         {
  1195.             $this->order_date $orderDate;
  1196.             return $this;
  1197.         }
  1198.         /**
  1199.          * Get orderDate.
  1200.          *
  1201.          * @return \DateTime|null
  1202.          */
  1203.         public function getOrderDate()
  1204.         {
  1205.             return $this->order_date;
  1206.         }
  1207.         /**
  1208.          * Set paymentDate.
  1209.          *
  1210.          * @param \DateTime|null $paymentDate
  1211.          *
  1212.          * @return Order
  1213.          */
  1214.         public function setPaymentDate($paymentDate null)
  1215.         {
  1216.             $this->payment_date $paymentDate;
  1217.             return $this;
  1218.         }
  1219.         /**
  1220.          * Get paymentDate.
  1221.          *
  1222.          * @return \DateTime|null
  1223.          */
  1224.         public function getPaymentDate()
  1225.         {
  1226.             return $this->payment_date;
  1227.         }
  1228.         /**
  1229.          * Get currencyCode.
  1230.          *
  1231.          * @return string
  1232.          */
  1233.         public function getCurrencyCode()
  1234.         {
  1235.             return $this->currency_code;
  1236.         }
  1237.         /**
  1238.          * Set currencyCode.
  1239.          *
  1240.          * @param string|null $currencyCode
  1241.          *
  1242.          * @return $this
  1243.          */
  1244.         public function setCurrencyCode($currencyCode null)
  1245.         {
  1246.             $this->currency_code $currencyCode;
  1247.             return $this;
  1248.         }
  1249.         /**
  1250.          * @return string|null
  1251.          */
  1252.         public function getCompleteMessage()
  1253.         {
  1254.             return $this->complete_message;
  1255.         }
  1256.         /**
  1257.          * @param string|null $complete_message
  1258.          *
  1259.          * @return $this
  1260.          */
  1261.         public function setCompleteMessage($complete_message null)
  1262.         {
  1263.             $this->complete_message $complete_message;
  1264.             return $this;
  1265.         }
  1266.         /**
  1267.          * @param string|null $complete_message
  1268.          *
  1269.          * @return $this
  1270.          */
  1271.         public function appendCompleteMessage($complete_message null)
  1272.         {
  1273.             $this->complete_message .= $complete_message;
  1274.             return $this;
  1275.         }
  1276.         /**
  1277.          * @return string|null
  1278.          */
  1279.         public function getCompleteMailMessage()
  1280.         {
  1281.             return $this->complete_mail_message;
  1282.         }
  1283.         /**
  1284.          * @param string|null $complete_mail_message
  1285.          *
  1286.          * @return
  1287.          */
  1288.         public function setCompleteMailMessage($complete_mail_message null)
  1289.         {
  1290.             $this->complete_mail_message $complete_mail_message;
  1291.             return $this;
  1292.         }
  1293.         /**
  1294.          * @param string|null $complete_mail_message
  1295.          *
  1296.          * @return
  1297.          */
  1298.         public function appendCompleteMailMessage($complete_mail_message null)
  1299.         {
  1300.             $this->complete_mail_message .= $complete_mail_message;
  1301.             return $this;
  1302.         }
  1303.         /**
  1304.          * 商品の受注明細を取得
  1305.          *
  1306.          * @return OrderItem[]
  1307.          */
  1308.         public function getProductOrderItems()
  1309.         {
  1310.             $sio = new OrderItemCollection($this->OrderItems->toArray());
  1311.             return array_values($sio->getProductClasses()->toArray());
  1312.         }
  1313.         /**
  1314.          * Add orderItem.
  1315.          *
  1316.          * @param \Eccube\Entity\OrderItem $OrderItem
  1317.          *
  1318.          * @return Order
  1319.          */
  1320.         public function addOrderItem(OrderItem $OrderItem)
  1321.         {
  1322.             $this->OrderItems[] = $OrderItem;
  1323.             return $this;
  1324.         }
  1325.         /**
  1326.          * Remove orderItem.
  1327.          *
  1328.          * @param \Eccube\Entity\OrderItem $OrderItem
  1329.          *
  1330.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1331.          */
  1332.         public function removeOrderItem(OrderItem $OrderItem)
  1333.         {
  1334.             return $this->OrderItems->removeElement($OrderItem);
  1335.         }
  1336.         /**
  1337.          * Get orderItems.
  1338.          *
  1339.          * @return \Doctrine\Common\Collections\Collection|OrderItem[]
  1340.          */
  1341.         public function getOrderItems()
  1342.         {
  1343.             return $this->OrderItems;
  1344.         }
  1345.         /**
  1346.          * Sorted to getOrderItems()
  1347.          *
  1348.          * @return ItemCollection
  1349.          */
  1350.         public function getItems()
  1351.         {
  1352.             return (new ItemCollection($this->getOrderItems()))->sort();
  1353.         }
  1354.         /**
  1355.          * Add shipping.
  1356.          *
  1357.          * @param \Eccube\Entity\Shipping $Shipping
  1358.          *
  1359.          * @return Order
  1360.          */
  1361.         public function addShipping(Shipping $Shipping)
  1362.         {
  1363.             $this->Shippings[] = $Shipping;
  1364.             return $this;
  1365.         }
  1366.         /**
  1367.          * Remove shipping.
  1368.          *
  1369.          * @param \Eccube\Entity\Shipping $Shipping
  1370.          *
  1371.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1372.          */
  1373.         public function removeShipping(Shipping $Shipping)
  1374.         {
  1375.             return $this->Shippings->removeElement($Shipping);
  1376.         }
  1377.         /**
  1378.          * Get shippings.
  1379.          *
  1380.          * @return \Doctrine\Common\Collections\Collection|\Eccube\Entity\Shipping[]
  1381.          */
  1382.         public function getShippings()
  1383.         {
  1384.             $criteria Criteria::create()
  1385.                 ->orderBy(['name01' => Criteria::ASC'name02' => Criteria::ASC'id' => Criteria::ASC]);
  1386.             return $this->Shippings->matching($criteria);
  1387.         }
  1388.         /**
  1389.          * Add mailHistory.
  1390.          *
  1391.          * @param \Eccube\Entity\MailHistory $mailHistory
  1392.          *
  1393.          * @return Order
  1394.          */
  1395.         public function addMailHistory(MailHistory $mailHistory)
  1396.         {
  1397.             $this->MailHistories[] = $mailHistory;
  1398.             return $this;
  1399.         }
  1400.         /**
  1401.          * Remove mailHistory.
  1402.          *
  1403.          * @param \Eccube\Entity\MailHistory $mailHistory
  1404.          *
  1405.          * @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
  1406.          */
  1407.         public function removeMailHistory(MailHistory $mailHistory)
  1408.         {
  1409.             return $this->MailHistories->removeElement($mailHistory);
  1410.         }
  1411.         /**
  1412.          * Get mailHistories.
  1413.          *
  1414.          * @return \Doctrine\Common\Collections\Collection
  1415.          */
  1416.         public function getMailHistories()
  1417.         {
  1418.             return $this->MailHistories;
  1419.         }
  1420.         /**
  1421.          * Set customer.
  1422.          *
  1423.          * @param \Eccube\Entity\Customer|null $customer
  1424.          *
  1425.          * @return Order
  1426.          */
  1427.         public function setCustomer(Customer $customer null)
  1428.         {
  1429.             $this->Customer $customer;
  1430.             return $this;
  1431.         }
  1432.         /**
  1433.          * Get customer.
  1434.          *
  1435.          * @return \Eccube\Entity\Customer|null
  1436.          */
  1437.         public function getCustomer()
  1438.         {
  1439.             return $this->Customer;
  1440.         }
  1441.         /**
  1442.          * Set country.
  1443.          *
  1444.          * @param \Eccube\Entity\Master\Country|null $country
  1445.          *
  1446.          * @return Order
  1447.          */
  1448.         public function setCountry(Master\Country $country null)
  1449.         {
  1450.             $this->Country $country;
  1451.             return $this;
  1452.         }
  1453.         /**
  1454.          * Get country.
  1455.          *
  1456.          * @return \Eccube\Entity\Master\Country|null
  1457.          */
  1458.         public function getCountry()
  1459.         {
  1460.             return $this->Country;
  1461.         }
  1462.         /**
  1463.          * Set pref.
  1464.          *
  1465.          * @param \Eccube\Entity\Master\Pref|null $pref
  1466.          *
  1467.          * @return Order
  1468.          */
  1469.         public function setPref(Master\Pref $pref null)
  1470.         {
  1471.             $this->Pref $pref;
  1472.             return $this;
  1473.         }
  1474.         /**
  1475.          * Get pref.
  1476.          *
  1477.          * @return \Eccube\Entity\Master\Pref|null
  1478.          */
  1479.         public function getPref()
  1480.         {
  1481.             return $this->Pref;
  1482.         }
  1483.         /**
  1484.          * Set sex.
  1485.          *
  1486.          * @param \Eccube\Entity\Master\Sex|null $sex
  1487.          *
  1488.          * @return Order
  1489.          */
  1490.         public function setSex(Master\Sex $sex null)
  1491.         {
  1492.             $this->Sex $sex;
  1493.             return $this;
  1494.         }
  1495.         /**
  1496.          * Get sex.
  1497.          *
  1498.          * @return \Eccube\Entity\Master\Sex|null
  1499.          */
  1500.         public function getSex()
  1501.         {
  1502.             return $this->Sex;
  1503.         }
  1504.         /**
  1505.          * Set job.
  1506.          *
  1507.          * @param \Eccube\Entity\Master\Job|null $job
  1508.          *
  1509.          * @return Order
  1510.          */
  1511.         public function setJob(Master\Job $job null)
  1512.         {
  1513.             $this->Job $job;
  1514.             return $this;
  1515.         }
  1516.         /**
  1517.          * Get job.
  1518.          *
  1519.          * @return \Eccube\Entity\Master\Job|null
  1520.          */
  1521.         public function getJob()
  1522.         {
  1523.             return $this->Job;
  1524.         }
  1525.         /**
  1526.          * Set payment.
  1527.          *
  1528.          * @param \Eccube\Entity\Payment|null $payment
  1529.          *
  1530.          * @return Order
  1531.          */
  1532.         public function setPayment(Payment $payment null)
  1533.         {
  1534.             $this->Payment $payment;
  1535.             return $this;
  1536.         }
  1537.         /**
  1538.          * Get payment.
  1539.          *
  1540.          * @return \Eccube\Entity\Payment|null
  1541.          */
  1542.         public function getPayment()
  1543.         {
  1544.             return $this->Payment;
  1545.         }
  1546.         /**
  1547.          * Set deviceType.
  1548.          *
  1549.          * @param \Eccube\Entity\Master\DeviceType|null $deviceType
  1550.          *
  1551.          * @return Order
  1552.          */
  1553.         public function setDeviceType(Master\DeviceType $deviceType null)
  1554.         {
  1555.             $this->DeviceType $deviceType;
  1556.             return $this;
  1557.         }
  1558.         /**
  1559.          * Get deviceType.
  1560.          *
  1561.          * @return \Eccube\Entity\Master\DeviceType|null
  1562.          */
  1563.         public function getDeviceType()
  1564.         {
  1565.             return $this->DeviceType;
  1566.         }
  1567.         /**
  1568.          * Set customerOrderStatus.
  1569.          *
  1570.          * @param \Eccube\Entity\Master\CustomerOrderStatus|null $customerOrderStatus
  1571.          *
  1572.          * @return Order
  1573.          */
  1574.         public function setCustomerOrderStatus(Master\CustomerOrderStatus $customerOrderStatus null)
  1575.         {
  1576.             $this->CustomerOrderStatus $customerOrderStatus;
  1577.             return $this;
  1578.         }
  1579.         /**
  1580.          * Get customerOrderStatus.
  1581.          *
  1582.          * @return \Eccube\Entity\Master\CustomerOrderStatus|null
  1583.          */
  1584.         public function getCustomerOrderStatus()
  1585.         {
  1586.             return $this->CustomerOrderStatus;
  1587.         }
  1588.         /**
  1589.          * Set orderStatusColor.
  1590.          *
  1591.          * @param \Eccube\Entity\Master\OrderStatusColor|null $orderStatusColor
  1592.          *
  1593.          * @return Order
  1594.          */
  1595.         public function setOrderStatusColor(Master\OrderStatusColor $orderStatusColor null)
  1596.         {
  1597.             $this->OrderStatusColor $orderStatusColor;
  1598.             return $this;
  1599.         }
  1600.         /**
  1601.          * Get orderStatusColor.
  1602.          *
  1603.          * @return \Eccube\Entity\Master\OrderStatusColor|null
  1604.          */
  1605.         public function getOrderStatusColor()
  1606.         {
  1607.             return $this->OrderStatusColor;
  1608.         }
  1609.         /**
  1610.          * Set orderStatus.
  1611.          *
  1612.          * @param \Eccube\Entity\Master\OrderStatus|object|null $orderStatus
  1613.          *
  1614.          * @return Order
  1615.          */
  1616.         public function setOrderStatus(Master\OrderStatus $orderStatus null)
  1617.         {
  1618.             $this->OrderStatus $orderStatus;
  1619.             return $this;
  1620.         }
  1621.         /**
  1622.          * Get orderStatus.
  1623.          *
  1624.          * @return \Eccube\Entity\Master\OrderStatus|null
  1625.          */
  1626.         public function getOrderStatus()
  1627.         {
  1628.             return $this->OrderStatus;
  1629.         }
  1630.         /**
  1631.          * @param ItemInterface $item
  1632.          */
  1633.         public function addItem(ItemInterface $item)
  1634.         {
  1635.             $this->OrderItems->add($item);
  1636.         }
  1637.         public function getQuantity()
  1638.         {
  1639.             $quantity 0;
  1640.             foreach ($this->getItems() as $item) {
  1641.                 $quantity += $item->getQuantity();
  1642.             }
  1643.             return $quantity;
  1644.         }
  1645.     }