app/proxy/entity/src/Eccube/Entity/OrderItem.php line 31

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\ORM\Mapping as ORM;
  14. use Eccube\Entity\Master\OrderItemType;
  15. use Eccube\Entity\Master\RoundingType;
  16. use Eccube\Entity\Master\TaxDisplayType;
  17.     /**
  18.      * OrderItem
  19.      *
  20.      * @ORM\Table(name="dtb_order_item")
  21.      * @ORM\InheritanceType("SINGLE_TABLE")
  22.      * @ORM\DiscriminatorColumn(name="discriminator_type", type="string", length=255)
  23.      * @ORM\HasLifecycleCallbacks()
  24.      * @ORM\Entity(repositoryClass="Eccube\Repository\OrderItemRepository")
  25.      */
  26.     class OrderItem extends \Eccube\Entity\AbstractEntity implements ItemInterface
  27.     {
  28.         use PointRateTrait, \Plugin\ProductOption42\Entity\OrderItemTrait;
  29.         /**
  30.          * Get price IncTax
  31.          *
  32.          * @return string
  33.          */
  34.         public function getPriceIncTax()
  35.         {
  36.             // 税表示区分が税込の場合は, priceに税込金額が入っている.
  37.             if ($this->TaxDisplayType && $this->TaxDisplayType->getId() == TaxDisplayType::INCLUDED) {
  38.                 return $this->price;
  39.             }
  40.             return $this->price $this->tax;
  41.         }
  42.         /**
  43.          * @return integer
  44.          */
  45.         public function getTotalPrice()
  46.         {
  47.             return $this->getPriceIncTax() * $this->getQuantity();
  48.         }
  49.         /**
  50.          * @return integer
  51.          */
  52.         public function getOrderItemTypeId()
  53.         {
  54.             if (is_object($this->getOrderItemType())) {
  55.                 return $this->getOrderItemType()->getId();
  56.             }
  57.             return null;
  58.         }
  59.         /**
  60.          * 商品明細かどうか.
  61.          *
  62.          * @return boolean 商品明細の場合 true
  63.          */
  64.         public function isProduct()
  65.         {
  66.             return $this->getOrderItemTypeId() === OrderItemType::PRODUCT;
  67.         }
  68.         /**
  69.          * 送料明細かどうか.
  70.          *
  71.          * @return boolean 送料明細の場合 true
  72.          */
  73.         public function isDeliveryFee()
  74.         {
  75.             return $this->getOrderItemTypeId() === OrderItemType::DELIVERY_FEE;
  76.         }
  77.         /**
  78.          * 手数料明細かどうか.
  79.          *
  80.          * @return boolean 手数料明細の場合 true
  81.          */
  82.         public function isCharge()
  83.         {
  84.             return $this->getOrderItemTypeId() === OrderItemType::CHARGE;
  85.         }
  86.         /**
  87.          * 値引き明細かどうか.
  88.          *
  89.          * @return boolean 値引き明細の場合 true
  90.          */
  91.         public function isDiscount()
  92.         {
  93.             return $this->getOrderItemTypeId() === OrderItemType::DISCOUNT;
  94.         }
  95.         /**
  96.          * 税額明細かどうか.
  97.          *
  98.          * @return boolean 税額明細の場合 true
  99.          */
  100.         public function isTax()
  101.         {
  102.             return $this->getOrderItemTypeId() === OrderItemType::TAX;
  103.         }
  104.         /**
  105.          * ポイント明細かどうか.
  106.          *
  107.          * @return boolean ポイント明細の場合 true
  108.          */
  109.         public function isPoint()
  110.         {
  111.             return $this->getOrderItemTypeId() === OrderItemType::POINT;
  112.         }
  113.         /**
  114.          * @var integer
  115.          *
  116.          * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  117.          * @ORM\Id
  118.          * @ORM\GeneratedValue(strategy="IDENTITY")
  119.          */
  120.         private $id;
  121.         /**
  122.          * @var string
  123.          *
  124.          * @ORM\Column(name="product_name", type="string", length=255)
  125.          */
  126.         private $product_name;
  127.         /**
  128.          * @var string|null
  129.          *
  130.          * @ORM\Column(name="product_code", type="string", length=255, nullable=true)
  131.          */
  132.         private $product_code;
  133.         /**
  134.          * @var string|null
  135.          *
  136.          * @ORM\Column(name="class_name1", type="string", length=255, nullable=true)
  137.          */
  138.         private $class_name1;
  139.         /**
  140.          * @var string|null
  141.          *
  142.          * @ORM\Column(name="class_name2", type="string", length=255, nullable=true)
  143.          */
  144.         private $class_name2;
  145.         /**
  146.          * @var string|null
  147.          *
  148.          * @ORM\Column(name="class_category_name1", type="string", length=255, nullable=true)
  149.          */
  150.         private $class_category_name1;
  151.         /**
  152.          * @var string|null
  153.          *
  154.          * @ORM\Column(name="class_category_name2", type="string", length=255, nullable=true)
  155.          */
  156.         private $class_category_name2;
  157.         /**
  158.          * @var string
  159.          *
  160.          * @ORM\Column(name="price", type="decimal", precision=12, scale=2, options={"default":0})
  161.          */
  162.         private $price 0;
  163.         /**
  164.          * @var string
  165.          *
  166.          * @ORM\Column(name="quantity", type="decimal", precision=10, scale=0, options={"default":0})
  167.          */
  168.         private $quantity 0;
  169.         /**
  170.          * @var string
  171.          *
  172.          * @ORM\Column(name="tax", type="decimal", precision=10, scale=0, options={"default":0})
  173.          */
  174.         private $tax 0;
  175.         /**
  176.          * @var string
  177.          *
  178.          * @ORM\Column(name="tax_rate", type="decimal", precision=10, scale=0, options={"unsigned":true,"default":0})
  179.          */
  180.         private $tax_rate 0;
  181.         /**
  182.          * @var string
  183.          *
  184.          * @ORM\Column(name="tax_adjust", type="decimal", precision=10, scale=0, options={"unsigned":true,"default":0})
  185.          */
  186.         private $tax_adjust 0;
  187.         /**
  188.          * @var int|null
  189.          *
  190.          * @ORM\Column(name="tax_rule_id", type="smallint", nullable=true, options={"unsigned":true})
  191.          */
  192.         private $tax_rule_id;
  193.         /**
  194.          * @var string|null
  195.          *
  196.          * @ORM\Column(name="currency_code", type="string", nullable=true)
  197.          */
  198.         private $currency_code;
  199.         /**
  200.          * @var string|null
  201.          *
  202.          * @ORM\Column(name="processor_name", type="string", nullable=true)
  203.          */
  204.         private $processor_name;
  205.         /**
  206.          * @var \Eccube\Entity\Order
  207.          *
  208.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Order", inversedBy="OrderItems")
  209.          * @ORM\JoinColumns({
  210.          *   @ORM\JoinColumn(name="order_id", referencedColumnName="id")
  211.          * })
  212.          */
  213.         private $Order;
  214.         /**
  215.          * @var \Eccube\Entity\Product
  216.          *
  217.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Product")
  218.          * @ORM\JoinColumns({
  219.          *   @ORM\JoinColumn(name="product_id", referencedColumnName="id")
  220.          * })
  221.          */
  222.         private $Product;
  223.         /**
  224.          * @var \Eccube\Entity\ProductClass
  225.          *
  226.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\ProductClass")
  227.          * @ORM\JoinColumns({
  228.          *   @ORM\JoinColumn(name="product_class_id", referencedColumnName="id")
  229.          * })
  230.          */
  231.         private $ProductClass;
  232.         /**
  233.          * @var \Eccube\Entity\Shipping
  234.          *
  235.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Shipping", inversedBy="OrderItems")
  236.          * @ORM\JoinColumns({
  237.          *   @ORM\JoinColumn(name="shipping_id", referencedColumnName="id")
  238.          * })
  239.          */
  240.         private $Shipping;
  241.         /**
  242.          * @var \Eccube\Entity\Master\RoundingType
  243.          *
  244.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\RoundingType")
  245.          * @ORM\JoinColumns({
  246.          *   @ORM\JoinColumn(name="rounding_type_id", referencedColumnName="id")
  247.          * })
  248.          */
  249.         private $RoundingType;
  250.         /**
  251.          * @var \Eccube\Entity\Master\TaxType
  252.          *
  253.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\TaxType")
  254.          * @ORM\JoinColumns({
  255.          *   @ORM\JoinColumn(name="tax_type_id", referencedColumnName="id")
  256.          * })
  257.          */
  258.         private $TaxType;
  259.         /**
  260.          * @var \Eccube\Entity\Master\TaxDisplayType
  261.          *
  262.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\TaxDisplayType")
  263.          * @ORM\JoinColumns({
  264.          *   @ORM\JoinColumn(name="tax_display_type_id", referencedColumnName="id")
  265.          * })
  266.          */
  267.         private $TaxDisplayType;
  268.         /**
  269.          * @var \Eccube\Entity\Master\OrderItemType
  270.          *
  271.          * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\OrderItemType")
  272.          * @ORM\JoinColumns({
  273.          *   @ORM\JoinColumn(name="order_item_type_id", referencedColumnName="id")
  274.          * })
  275.          */
  276.         private $OrderItemType;
  277.         /**
  278.          * Get id.
  279.          *
  280.          * @return int
  281.          */
  282.         public function getId()
  283.         {
  284.             return $this->id;
  285.         }
  286.         /**
  287.          * Set productName.
  288.          *
  289.          * @param string $productName
  290.          *
  291.          * @return OrderItem
  292.          */
  293.         public function setProductName($productName)
  294.         {
  295.             $this->product_name $productName;
  296.             return $this;
  297.         }
  298.         /**
  299.          * Get productName.
  300.          *
  301.          * @return string
  302.          */
  303.         public function getProductName()
  304.         {
  305.             return $this->product_name;
  306.         }
  307.         /**
  308.          * Set productCode.
  309.          *
  310.          * @param string|null $productCode
  311.          *
  312.          * @return OrderItem
  313.          */
  314.         public function setProductCode($productCode null)
  315.         {
  316.             $this->product_code $productCode;
  317.             return $this;
  318.         }
  319.         /**
  320.          * Get productCode.
  321.          *
  322.          * @return string|null
  323.          */
  324.         public function getProductCode()
  325.         {
  326.             return $this->product_code;
  327.         }
  328.         /**
  329.          * Set className1.
  330.          *
  331.          * @param string|null $className1
  332.          *
  333.          * @return OrderItem
  334.          */
  335.         public function setClassName1($className1 null)
  336.         {
  337.             $this->class_name1 $className1;
  338.             return $this;
  339.         }
  340.         /**
  341.          * Get className1.
  342.          *
  343.          * @return string|null
  344.          */
  345.         public function getClassName1()
  346.         {
  347.             return $this->class_name1;
  348.         }
  349.         /**
  350.          * Set className2.
  351.          *
  352.          * @param string|null $className2
  353.          *
  354.          * @return OrderItem
  355.          */
  356.         public function setClassName2($className2 null)
  357.         {
  358.             $this->class_name2 $className2;
  359.             return $this;
  360.         }
  361.         /**
  362.          * Get className2.
  363.          *
  364.          * @return string|null
  365.          */
  366.         public function getClassName2()
  367.         {
  368.             return $this->class_name2;
  369.         }
  370.         /**
  371.          * Set classCategoryName1.
  372.          *
  373.          * @param string|null $classCategoryName1
  374.          *
  375.          * @return OrderItem
  376.          */
  377.         public function setClassCategoryName1($classCategoryName1 null)
  378.         {
  379.             $this->class_category_name1 $classCategoryName1;
  380.             return $this;
  381.         }
  382.         /**
  383.          * Get classCategoryName1.
  384.          *
  385.          * @return string|null
  386.          */
  387.         public function getClassCategoryName1()
  388.         {
  389.             return $this->class_category_name1;
  390.         }
  391.         /**
  392.          * Set classCategoryName2.
  393.          *
  394.          * @param string|null $classCategoryName2
  395.          *
  396.          * @return OrderItem
  397.          */
  398.         public function setClassCategoryName2($classCategoryName2 null)
  399.         {
  400.             $this->class_category_name2 $classCategoryName2;
  401.             return $this;
  402.         }
  403.         /**
  404.          * Get classCategoryName2.
  405.          *
  406.          * @return string|null
  407.          */
  408.         public function getClassCategoryName2()
  409.         {
  410.             return $this->class_category_name2;
  411.         }
  412.         /**
  413.          * Set price.
  414.          *
  415.          * @param string $price
  416.          *
  417.          * @return OrderItem
  418.          */
  419.         public function setPrice($price)
  420.         {
  421.             $this->price $price;
  422.             return $this;
  423.         }
  424.         /**
  425.          * Get price.
  426.          *
  427.          * @return string
  428.          */
  429.         public function getPrice()
  430.         {
  431.             return $this->price;
  432.         }
  433.         /**
  434.          * Set quantity.
  435.          *
  436.          * @param string $quantity
  437.          *
  438.          * @return OrderItem
  439.          */
  440.         public function setQuantity($quantity)
  441.         {
  442.             $this->quantity $quantity;
  443.             return $this;
  444.         }
  445.         /**
  446.          * Get quantity.
  447.          *
  448.          * @return string
  449.          */
  450.         public function getQuantity()
  451.         {
  452.             return $this->quantity;
  453.         }
  454.         /**
  455.          * @return string
  456.          */
  457.         public function getTax()
  458.         {
  459.             return $this->tax;
  460.         }
  461.         /**
  462.          * @param string $tax
  463.          *
  464.          * @return $this
  465.          */
  466.         public function setTax($tax)
  467.         {
  468.             $this->tax $tax;
  469.             return $this;
  470.         }
  471.         /**
  472.          * Set taxRate.
  473.          *
  474.          * @param string $taxRate
  475.          *
  476.          * @return OrderItem
  477.          */
  478.         public function setTaxRate($taxRate)
  479.         {
  480.             $this->tax_rate $taxRate;
  481.             return $this;
  482.         }
  483.         /**
  484.          * Get taxRate.
  485.          *
  486.          * @return string
  487.          */
  488.         public function getTaxRate()
  489.         {
  490.             return $this->tax_rate;
  491.         }
  492.         /**
  493.          * Set taxAdjust.
  494.          *
  495.          * @param string $tax_adjust
  496.          *
  497.          * @return OrderItem
  498.          */
  499.         public function setTaxAdjust($tax_adjust)
  500.         {
  501.             $this->tax_adjust $tax_adjust;
  502.             return $this;
  503.         }
  504.         /**
  505.          * Get taxAdjust.
  506.          *
  507.          * @return string
  508.          */
  509.         public function getTaxAdjust()
  510.         {
  511.             return $this->tax_adjust;
  512.         }
  513.         /**
  514.          * Set taxRuleId.
  515.          *
  516.          * @deprecated 税率設定は受注作成時に決定するため廃止予定
  517.          *
  518.          * @param int|null $taxRuleId
  519.          *
  520.          * @return OrderItem
  521.          */
  522.         public function setTaxRuleId($taxRuleId null)
  523.         {
  524.             $this->tax_rule_id $taxRuleId;
  525.             return $this;
  526.         }
  527.         /**
  528.          * Get taxRuleId.
  529.          *
  530.          * @deprecated 税率設定は受注作成時に決定するため廃止予定
  531.          *
  532.          * @return int|null
  533.          */
  534.         public function getTaxRuleId()
  535.         {
  536.             return $this->tax_rule_id;
  537.         }
  538.         /**
  539.          * Get currencyCode.
  540.          *
  541.          * @return string
  542.          */
  543.         public function getCurrencyCode()
  544.         {
  545.             return $this->currency_code;
  546.         }
  547.         /**
  548.          * Set currencyCode.
  549.          *
  550.          * @param string|null $currencyCode
  551.          *
  552.          * @return OrderItem
  553.          */
  554.         public function setCurrencyCode($currencyCode null)
  555.         {
  556.             $this->currency_code $currencyCode;
  557.             return $this;
  558.         }
  559.         /**
  560.          * Get processorName.
  561.          *
  562.          * @return string
  563.          */
  564.         public function getProcessorName()
  565.         {
  566.             return $this->processor_name;
  567.         }
  568.         /**
  569.          * Set processorName.
  570.          *
  571.          * @param string|null $processorName
  572.          *
  573.          * @return $this
  574.          */
  575.         public function setProcessorName($processorName null)
  576.         {
  577.             $this->processor_name $processorName;
  578.             return $this;
  579.         }
  580.         /**
  581.          * Set order.
  582.          *
  583.          * @param \Eccube\Entity\Order|null $order
  584.          *
  585.          * @return OrderItem
  586.          */
  587.         public function setOrder(Order $order null)
  588.         {
  589.             $this->Order $order;
  590.             return $this;
  591.         }
  592.         /**
  593.          * Get order.
  594.          *
  595.          * @return \Eccube\Entity\Order|null
  596.          */
  597.         public function getOrder()
  598.         {
  599.             return $this->Order;
  600.         }
  601.         public function getOrderId()
  602.         {
  603.             if (is_object($this->getOrder())) {
  604.                 return $this->getOrder()->getId();
  605.             }
  606.             return null;
  607.         }
  608.         /**
  609.          * Set product.
  610.          *
  611.          * @param \Eccube\Entity\Product|null $product
  612.          *
  613.          * @return OrderItem
  614.          */
  615.         public function setProduct(Product $product null)
  616.         {
  617.             $this->Product $product;
  618.             return $this;
  619.         }
  620.         /**
  621.          * Get product.
  622.          *
  623.          * @return \Eccube\Entity\Product|null
  624.          */
  625.         public function getProduct()
  626.         {
  627.             return $this->Product;
  628.         }
  629.         /**
  630.          * Set productClass.
  631.          *
  632.          * @param \Eccube\Entity\ProductClass|null $productClass
  633.          *
  634.          * @return OrderItem
  635.          */
  636.         public function setProductClass(ProductClass $productClass null)
  637.         {
  638.             $this->ProductClass $productClass;
  639.             return $this;
  640.         }
  641.         /**
  642.          * Get productClass.
  643.          *
  644.          * @return \Eccube\Entity\ProductClass|null
  645.          */
  646.         public function getProductClass()
  647.         {
  648.             return $this->ProductClass;
  649.         }
  650.         /**
  651.          * Set shipping.
  652.          *
  653.          * @param \Eccube\Entity\Shipping|null $shipping
  654.          *
  655.          * @return OrderItem
  656.          */
  657.         public function setShipping(Shipping $shipping null)
  658.         {
  659.             $this->Shipping $shipping;
  660.             return $this;
  661.         }
  662.         /**
  663.          * Get shipping.
  664.          *
  665.          * @return \Eccube\Entity\Shipping|null
  666.          */
  667.         public function getShipping()
  668.         {
  669.             return $this->Shipping;
  670.         }
  671.         /**
  672.          * @return RoundingType
  673.          */
  674.         public function getRoundingType()
  675.         {
  676.             return $this->RoundingType;
  677.         }
  678.         /**
  679.          * @param RoundingType $RoundingType
  680.          */
  681.         public function setRoundingType(RoundingType $RoundingType null)
  682.         {
  683.             $this->RoundingType $RoundingType;
  684.             return $this;
  685.         }
  686.         /**
  687.          * Set taxType
  688.          *
  689.          * @param \Eccube\Entity\Master\TaxType $taxType
  690.          *
  691.          * @return OrderItem
  692.          */
  693.         public function setTaxType(Master\TaxType $taxType null)
  694.         {
  695.             $this->TaxType $taxType;
  696.             return $this;
  697.         }
  698.         /**
  699.          * Get taxType
  700.          *
  701.          * @return \Eccube\Entity\Master\TaxType
  702.          */
  703.         public function getTaxType()
  704.         {
  705.             return $this->TaxType;
  706.         }
  707.         /**
  708.          * Set taxDisplayType
  709.          *
  710.          * @param \Eccube\Entity\Master\TaxDisplayType $taxDisplayType
  711.          *
  712.          * @return OrderItem
  713.          */
  714.         public function setTaxDisplayType(TaxDisplayType $taxDisplayType null)
  715.         {
  716.             $this->TaxDisplayType $taxDisplayType;
  717.             return $this;
  718.         }
  719.         /**
  720.          * Get taxDisplayType
  721.          *
  722.          * @return \Eccube\Entity\Master\TaxDisplayType
  723.          */
  724.         public function getTaxDisplayType()
  725.         {
  726.             return $this->TaxDisplayType;
  727.         }
  728.         /**
  729.          * Set orderItemType
  730.          *
  731.          * @param \Eccube\Entity\Master\OrderItemType $orderItemType
  732.          *
  733.          * @return OrderItem
  734.          */
  735.         public function setOrderItemType(OrderItemType $orderItemType null)
  736.         {
  737.             $this->OrderItemType $orderItemType;
  738.             return $this;
  739.         }
  740.         /**
  741.          * Get orderItemType
  742.          *
  743.          * @return \Eccube\Entity\Master\OrderItemType
  744.          */
  745.         public function getOrderItemType()
  746.         {
  747.             return $this->OrderItemType;
  748.         }
  749.     }