modules/CDev/Sale/src/Model/SaleDiscountProduct.php line 23

Open in your IDE?
  1. <?php
  2. /**
  3.  * Copyright (c) 2011-present Qualiteam software Ltd. All rights reserved.
  4.  * See https://www.x-cart.com/license-agreement.html for license details.
  5.  */
  6. namespace CDev\Sale\Model;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use XLite\Model\Product as ProductEntity;
  9. /**
  10.  * Category
  11.  *
  12.  * @ORM\Entity
  13.  * @ORM\Table (name="sale_discount_products",
  14.  *      uniqueConstraints={
  15.  *          @ORM\UniqueConstraint (name="pair", columns={"sale_id","product_id"})
  16.  *      },
  17.  * )
  18.  */
  19. class SaleDiscountProduct extends \XLite\Model\AEntity
  20. {
  21.     /**
  22.      * Primary key
  23.      *
  24.      * @var integer
  25.      *
  26.      * @ORM\Id
  27.      * @ORM\GeneratedValue (strategy="AUTO")
  28.      * @ORM\Column         (type="integer", options={ "unsigned": true })
  29.      */
  30.     protected $id;
  31.     /**
  32.      * Relation to a sale entity
  33.      *
  34.      * @var \CDev\Sale\Model\SaleDiscount
  35.      *
  36.      * @ORM\ManyToOne  (targetEntity="CDev\Sale\Model\SaleDiscount", inversedBy="saleDiscountProducts")
  37.      * @ORM\JoinColumn (name="sale_id", referencedColumnName="id", onDelete="CASCADE")
  38.      */
  39.     protected $saleDiscount;
  40.     /**
  41.      * Relation to a product entity
  42.      *
  43.      * @var ProductEntity
  44.      *
  45.      * @ORM\ManyToOne  (targetEntity="XLite\Model\Product", inversedBy="saleDiscountProducts")
  46.      * @ORM\JoinColumn (name="product_id", referencedColumnName="product_id", onDelete="CASCADE")
  47.      */
  48.     protected $product;
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getSaleDiscount(): ?SaleDiscount
  54.     {
  55.         return $this->saleDiscount;
  56.     }
  57.     public function setSaleDiscount(SaleDiscount $sale): SaleDiscountProduct
  58.     {
  59.         $this->saleDiscount $sale;
  60.         return $this;
  61.     }
  62.     public function getProduct(): ?ProductEntity
  63.     {
  64.         return $this->product;
  65.     }
  66.     public function setProduct(ProductEntity $product): SaleDiscountProduct
  67.     {
  68.         $this->product $product;
  69.         return $this;
  70.     }
  71.     public function getProductId(): int
  72.     {
  73.         return $this->getProduct()->getProductId();
  74.     }
  75.     /**
  76.      * @return string
  77.      */
  78.     public function getProductName()
  79.     {
  80.         return $this->getProduct()->getName();
  81.     }
  82.     /**
  83.      * @return float
  84.      */
  85.     public function getProductPrice()
  86.     {
  87.         return $this->getProduct()->getPrice();
  88.     }
  89.     /**
  90.      * @return string
  91.      */
  92.     public function getProductSku()
  93.     {
  94.         return $this->getProduct()->getSku();
  95.     }
  96.     /**
  97.      * @return int
  98.      */
  99.     public function getProductAmount()
  100.     {
  101.         return $this->getProduct()->getAmount();
  102.     }
  103. }