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

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