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