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