app/Plugin/EccubePaymentLite42/Entity/RegularOrderItem.php line 20

Open in your IDE?
  1. <?php
  2. namespace Plugin\EccubePaymentLite42\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Eccube\Entity\AbstractEntity;
  5. use Eccube\Entity\ItemInterface;
  6. use Eccube\Entity\Master\OrderItemType;
  7. use Eccube\Entity\Master\RoundingType;
  8. use Eccube\Entity\Master\TaxDisplayType;
  9. use Eccube\Entity\Master\TaxType;
  10. use Eccube\Entity\PointRateTrait;
  11. use Eccube\Entity\Product;
  12. use Eccube\Entity\ProductClass;
  13. /**
  14.  * @ORM\Table(name="plg_eccube_payment_lite42_regular_order_item")
  15.  * @ORM\Entity(repositoryClass="Plugin\EccubePaymentLite42\Repository\RegularOrderItemRepository")
  16.  */
  17. class RegularOrderItem extends AbstractEntity implements ItemInterface
  18. {
  19.     use PointRateTrait;
  20.     /**
  21.      * @ORM\Column(name="id", type="integer", options={"unsigned":true})
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue(strategy="IDENTITY")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\Column(name="product_name", type="string", length=255)
  28.      */
  29.     private $product_name;
  30.     /**
  31.      * @ORM\Column(name="product_code", type="string", length=255, nullable=true)
  32.      */
  33.     private $product_code;
  34.     /**
  35.      * @ORM\Column(name="class_name1", type="string", length=255, nullable=true)
  36.      */
  37.     private $class_name1;
  38.     /**
  39.      * @ORM\Column(name="class_name2", type="string", length=255, nullable=true)
  40.      */
  41.     private $class_name2;
  42.     /**
  43.      * @ORM\Column(name="class_category_name1", type="string", length=255, nullable=true)
  44.      */
  45.     private $class_category_name1;
  46.     /**
  47.      * @ORM\Column(name="class_category_name2", type="string", length=255, nullable=true)
  48.      */
  49.     private $class_category_name2;
  50.     /**
  51.      * @ORM\Column(name="price", type="decimal", precision=12, scale=2, options={"default":0})
  52.      */
  53.     private $price = 0;
  54.     /**
  55.      * @ORM\Column(name="quantity", type="decimal", precision=10, scale=0, options={"default":0})
  56.      */
  57.     private $quantity = 0;
  58.     /**
  59.      * @ORM\Column(name="tax", type="decimal", precision=10, scale=0, options={"default":0})
  60.      */
  61.     private $tax = 0;
  62.     /**
  63.      * @ORM\Column(name="tax_rate", type="decimal", precision=10, scale=0, options={"unsigned":true,"default":0})
  64.      */
  65.     private $tax_rate = 0;
  66.     /**
  67.      * @ORM\Column(name="tax_adjust", type="decimal", precision=10, scale=0, options={"unsigned":true,"default":0})
  68.      */
  69.     private $tax_adjust = 0;
  70.     /**
  71.      * @ORM\Column(name="tax_rule_id", type="smallint", nullable=true, options={"unsigned":true})
  72.      */
  73.     private $tax_rule_id;
  74.     /**
  75.      * @ORM\Column(name="currency_code", type="string", nullable=true)
  76.      */
  77.     private $currency_code;
  78.     /**
  79.      * @ORM\Column(name="processor_name", type="string", nullable=true)
  80.      */
  81.     private $processor_name;
  82.     /**
  83.      * @ORM\ManyToOne(targetEntity="Plugin\EccubePaymentLite42\Entity\RegularOrder", inversedBy="RegularOrderItems")
  84.      * @ORM\JoinColumn(name="regular_order_id", referencedColumnName="id")
  85.      */
  86.     private $RegularOrder;
  87.     /**
  88.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Product")
  89.      * @ORM\JoinColumn(name="product_id", referencedColumnName="id")
  90.      */
  91.     private $Product;
  92.     /**
  93.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\ProductClass")
  94.      * @ORM\JoinColumn(name="product_class_id", referencedColumnName="id")
  95.      */
  96.     private $ProductClass;
  97.     /**
  98.      * @ORM\ManyToOne(targetEntity="Plugin\EccubePaymentLite42\Entity\RegularShipping", inversedBy="RegularOrderItems")
  99.      * @ORM\JoinColumn(name="regular_shipping_id", referencedColumnName="id")
  100.      */
  101.     private $RegularShipping;
  102.     /**
  103.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\RoundingType")
  104.      * @ORM\JoinColumn(name="rounding_type_id", referencedColumnName="id")
  105.      */
  106.     private $RoundingType;
  107.     /**
  108.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\TaxType")
  109.      * @ORM\JoinColumn(name="tax_type_id", referencedColumnName="id")
  110.      */
  111.     private $TaxType;
  112.     /**
  113.      * @var TaxDisplayType
  114.      *
  115.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\TaxDisplayType")
  116.      * @ORM\JoinColumn(name="tax_display_type_id", referencedColumnName="id")
  117.      */
  118.     private $TaxDisplayType;
  119.     /**
  120.      * @ORM\ManyToOne(targetEntity="Eccube\Entity\Master\OrderItemType")
  121.      * @ORM\JoinColumn(name="order_item_type_id", referencedColumnName="id")
  122.      */
  123.     private $OrderItemType;
  124.     public function getId()
  125.     {
  126.         return $this->id;
  127.     }
  128.     public function setProductName($productName)
  129.     {
  130.         $this->product_name = $productName;
  131.         return $this;
  132.     }
  133.     public function getProductName()
  134.     {
  135.         return $this->product_name;
  136.     }
  137.     public function setProductCode($productCode = null)
  138.     {
  139.         $this->product_code = $productCode;
  140.         return $this;
  141.     }
  142.     public function getProductCode()
  143.     {
  144.         return $this->product_code;
  145.     }
  146.     public function setClassName1($className1 = null)
  147.     {
  148.         $this->class_name1 = $className1;
  149.         return $this;
  150.     }
  151.     public function getClassName1()
  152.     {
  153.         return $this->class_name1;
  154.     }
  155.     public function setClassName2($className2 = null)
  156.     {
  157.         $this->class_name2 = $className2;
  158.         return $this;
  159.     }
  160.     public function getClassName2()
  161.     {
  162.         return $this->class_name2;
  163.     }
  164.     public function setClassCategoryName1($classCategoryName1 = null)
  165.     {
  166.         $this->class_category_name1 = $classCategoryName1;
  167.         return $this;
  168.     }
  169.     public function getClassCategoryName1()
  170.     {
  171.         return $this->class_category_name1;
  172.     }
  173.     public function setClassCategoryName2($classCategoryName2 = null)
  174.     {
  175.         $this->class_category_name2 = $classCategoryName2;
  176.         return $this;
  177.     }
  178.     public function getClassCategoryName2()
  179.     {
  180.         return $this->class_category_name2;
  181.     }
  182.     public function setPrice($price)
  183.     {
  184.         $this->price = $price;
  185.         return $this;
  186.     }
  187.     public function getPrice()
  188.     {
  189.         return $this->price;
  190.     }
  191.     public function setQuantity($quantity)
  192.     {
  193.         $this->quantity = $quantity;
  194.         return $this;
  195.     }
  196.     public function getQuantity()
  197.     {
  198.         return $this->quantity;
  199.     }
  200.     public function getTax()
  201.     {
  202.         return $this->tax;
  203.     }
  204.     public function setTax($tax)
  205.     {
  206.         $this->tax = $tax;
  207.         return $this;
  208.     }
  209.     public function setTaxRate($taxRate)
  210.     {
  211.         $this->tax_rate = $taxRate;
  212.         return $this;
  213.     }
  214.     public function getTaxRate()
  215.     {
  216.         return $this->tax_rate;
  217.     }
  218.     public function setTaxAdjust($tax_adjust)
  219.     {
  220.         $this->tax_adjust = $tax_adjust;
  221.         return $this;
  222.     }
  223.     public function getTaxAdjust()
  224.     {
  225.         return $this->tax_adjust;
  226.     }
  227.     public function setTaxRuleId($taxRuleId = null)
  228.     {
  229.         $this->tax_rule_id = $taxRuleId;
  230.         return $this;
  231.     }
  232.     public function getTaxRuleId()
  233.     {
  234.         return $this->tax_rule_id;
  235.     }
  236.     public function getCurrencyCode()
  237.     {
  238.         return $this->currency_code;
  239.     }
  240.     public function setCurrencyCode($currencyCode = null)
  241.     {
  242.         $this->currency_code = $currencyCode;
  243.         return $this;
  244.     }
  245.     public function getProcessorName()
  246.     {
  247.         return $this->processor_name;
  248.     }
  249.     public function setProcessorName($processorName = null)
  250.     {
  251.         $this->processor_name = $processorName;
  252.         return $this;
  253.     }
  254.     public function setRegularOrder(RegularOrder $RegularOrder = null)
  255.     {
  256.         $this->RegularOrder = $RegularOrder;
  257.         return $this;
  258.     }
  259.     public function getRegularOrder()
  260.     {
  261.         return $this->RegularOrder;
  262.     }
  263.     public function setProduct(Product $product = null)
  264.     {
  265.         $this->Product = $product;
  266.         return $this;
  267.     }
  268.     public function getProduct()
  269.     {
  270.         return $this->Product;
  271.     }
  272.     public function setProductClass(ProductClass $productClass = null)
  273.     {
  274.         $this->ProductClass = $productClass;
  275.         return $this;
  276.     }
  277.     public function getProductClass()
  278.     {
  279.         return $this->ProductClass;
  280.     }
  281.     public function setRegularShipping(RegularShipping $RegularShipping = null)
  282.     {
  283.         $this->RegularShipping = $RegularShipping;
  284.         return $this;
  285.     }
  286.     public function getRegularShipping()
  287.     {
  288.         return $this->RegularShipping;
  289.     }
  290.     public function getRoundingType()
  291.     {
  292.         return $this->RoundingType;
  293.     }
  294.     public function setRoundingType(RoundingType $RoundingType = null)
  295.     {
  296.         $this->RoundingType = $RoundingType;
  297.         return $this;
  298.     }
  299.     public function setTaxType(TaxType $taxType = null)
  300.     {
  301.         $this->TaxType = $taxType;
  302.         return $this;
  303.     }
  304.     public function getTaxType()
  305.     {
  306.         return $this->TaxType;
  307.     }
  308.     public function setTaxDisplayType(TaxDisplayType $taxDisplayType = null)
  309.     {
  310.         $this->TaxDisplayType = $taxDisplayType;
  311.         return $this;
  312.     }
  313.     public function getTaxDisplayType()
  314.     {
  315.         return $this->TaxDisplayType;
  316.     }
  317.     public function setOrderItemType(OrderItemType $orderItemType = null)
  318.     {
  319.         $this->OrderItemType = $orderItemType;
  320.         return $this;
  321.     }
  322.     public function getOrderItemType()
  323.     {
  324.         return $this->OrderItemType;
  325.     }
  326.     public function getPriceIncTax()
  327.     {
  328.         // 税表示区分が税込の場合は, priceに税込金額が入っている.
  329.         if ($this->TaxDisplayType && $this->TaxDisplayType->getId() == TaxDisplayType::INCLUDED) {
  330.             return $this->price;
  331.         }
  332.         return $this->price + $this->tax;
  333.     }
  334.     public function getTotalPrice()
  335.     {
  336.         return $this->getPriceIncTax() * $this->getQuantity();
  337.     }
  338.     public function getOrderItemTypeId()
  339.     {
  340.         if (is_object($this->getOrderItemType())) {
  341.             return $this->getOrderItemType()->getId();
  342.         }
  343.         return null;
  344.     }
  345.     public function isProduct()
  346.     {
  347.         return $this->getOrderItemTypeId() === OrderItemType::PRODUCT;
  348.     }
  349.     public function isDeliveryFee()
  350.     {
  351.         return $this->getOrderItemTypeId() === OrderItemType::DELIVERY_FEE;
  352.     }
  353.     public function isCharge()
  354.     {
  355.         return $this->getOrderItemTypeId() === OrderItemType::CHARGE;
  356.     }
  357.     public function isDiscount()
  358.     {
  359.         return $this->getOrderItemTypeId() === OrderItemType::DISCOUNT;
  360.     }
  361.     public function isTax()
  362.     {
  363.         return $this->getOrderItemTypeId() === OrderItemType::TAX;
  364.     }
  365.     public function isPoint()
  366.     {
  367.         return $this->getOrderItemTypeId() === OrderItemType::POINT;
  368.     }
  369. }