src/Entity/Gos/SalesManagoCoupon.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Enum\CouponCombinationMode;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\SalesManagoCouponRepository")
  9.  */
  10. class SalesManagoCoupon
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255, nullable=true)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="integer", nullable=false)
  24.      */
  25.     private $hours;
  26.     /**
  27.      * @ORM\Column(type="text", nullable=false)
  28.      */
  29.     private $ruleId;
  30.     /**
  31.      * @var bool
  32.      *
  33.      * @ORM\Column(type="boolean", nullable=true)
  34.      */
  35.     private $isGross;
  36.     /**
  37.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
  38.      */
  39.     private $isCheckingDuplicatesEnabled;
  40.     /**
  41.      * @ORM\Column(type="boolean", nullable=true, options={"default" : 1})
  42.      */
  43.     private $checkUser;
  44.     /**
  45.      * @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
  46.      */
  47.     private $discount;
  48.     /**
  49.      * @ORM\Column(type="string", length=8, nullable=true)
  50.      */
  51.     private $actionNumber;
  52.     /**
  53.      * @ORM\Column(type="string", length=100, nullable=true)
  54.      */
  55.     private $fromSource;
  56.     /**
  57.      * @ORM\Column(type="string", length=100, nullable=true)
  58.      */
  59.     private $campaign;
  60.     /**
  61.      * @ORM\Column(type="string", length=100, nullable=true)
  62.      */
  63.     private $campaignChannel;
  64.     /**
  65.      * @ORM\Column(type="integer")
  66.      */
  67.     private $maximumQuantityUse;
  68.     /**
  69.      * @ORM\ManyToOne(targetEntity="App\Entity\Gos\CouponType", inversedBy="salesManagoCoupons")
  70.      * @ORM\JoinColumn()
  71.      */
  72.     private $couponType;
  73.     /**
  74.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="salesManagoCoupons")
  75.      * @ORM\JoinTable(name="product_variant_sm_coupon")
  76.      */
  77.     private $productVariant;
  78.     /**
  79.      * @ORM\ManyToMany(targetEntity="ProductVariantPack")
  80.      * @ORM\JoinTable(name="product_variant_pack_sm_coupon")
  81.      */
  82.     private $productVariantPacks;
  83.     /**
  84.      * @ORM\ManyToMany(targetEntity="App\Entity\Gos\ProductVariant", inversedBy="salesManagoGratisCoupons")
  85.      * @ORM\JoinTable(name="product_variant_sm_gratis_coupon")
  86.      */
  87.     private $gratis;
  88.     /**
  89.      * @var float
  90.      *
  91.      * @ORM\Column(type="float", precision=18, scale=2, nullable=true)
  92.      */
  93.     private $gratisPriceGross;
  94.     /**
  95.      * @var float
  96.      *
  97.      * @ORM\Column(type="float", precision=18, scale=2, nullable=true)
  98.      */
  99.     private $gratisPriceNet;
  100.     /**
  101.      * @var string
  102.      *
  103.      * @ORM\Column(name="description", type="text", nullable=true)
  104.      */
  105.     private $description;
  106.     /**
  107.      * @ORM\Column(type="boolean", nullable=true)
  108.      */
  109.     private $appliesToPack;
  110.     /**
  111.      * @ORM\Column(type="string", nullable=false, options={"default":"none"})
  112.      */
  113.     private $combinationMode CouponCombinationMode::NONE;
  114.     /**
  115.      * Constructor
  116.      */
  117.     public function __construct()
  118.     {
  119.         $this->productVariant   = new \Doctrine\Common\Collections\ArrayCollection();
  120.         $this->gratis           = new \Doctrine\Common\Collections\ArrayCollection();
  121.         $this->productVariantPacks = new ArrayCollection();
  122.     }
  123.     /**     * Get id
  124.      *
  125.      * @return integer
  126.      */
  127.     public function getId()
  128.     {
  129.         return $this->id;
  130.     }
  131.     public function getName()
  132.     {
  133.         return $this->name;
  134.     }
  135.     public function setName($name)
  136.     {
  137.         $this->name $name;
  138.         return $this;
  139.     }
  140.     /**
  141.      * Set hours
  142.      *
  143.      * @param integer $hours
  144.      *
  145.      * @return SalesManagoCoupon
  146.      */
  147.     public function setHours($hours)
  148.     {
  149.         $this->hours $hours;
  150.         return $this;
  151.     }
  152.     /**
  153.      * Get hours
  154.      *
  155.      * @return integer
  156.      */
  157.     public function getHours()
  158.     {
  159.         return $this->hours;
  160.     }
  161.     /**
  162.      * Set ruleId
  163.      *
  164.      * @param string $ruleId
  165.      *
  166.      * @return SalesManagoCoupon
  167.      */
  168.     public function setRuleId($ruleId)
  169.     {
  170.         $this->ruleId $ruleId;
  171.         return $this;
  172.     }
  173.     /**
  174.      * Get ruleId
  175.      *
  176.      * @return string
  177.      */
  178.     public function getRuleId()
  179.     {
  180.         return $this->ruleId;
  181.     }
  182.     /**
  183.      * Set isGross
  184.      *
  185.      * @param boolean $isGross
  186.      *
  187.      * @return SalesManagoCoupon
  188.      */
  189.     public function setIsGross($isGross)
  190.     {
  191.         $this->isGross $isGross;
  192.         return $this;
  193.     }
  194.     /**
  195.      * Get isGross
  196.      *
  197.      * @return boolean
  198.      */
  199.     public function getIsGross()
  200.     {
  201.         return $this->isGross;
  202.     }
  203.     /**
  204.      * Set isCheckingDuplicatesEnabled
  205.      *
  206.      * @param boolean $isCheckingDuplicatesEnabled
  207.      *
  208.      * @return SalesManagoCoupon
  209.      */
  210.     public function setIsCheckingDuplicatesEnabled($isCheckingDuplicatesEnabled)
  211.     {
  212.         $this->isCheckingDuplicatesEnabled $isCheckingDuplicatesEnabled;
  213.         return $this;
  214.     }
  215.     /**
  216.      * Get isCheckingDuplicatesEnabled
  217.      *
  218.      * @return boolean
  219.      */
  220.     public function getIsCheckingDuplicatesEnabled()
  221.     {
  222.         return $this->isCheckingDuplicatesEnabled;
  223.     }
  224.     /**
  225.      * @param boolean $checkUser
  226.      * @return SalesManagoCoupon
  227.      */
  228.     public function setCheckUser($checkUser): SalesManagoCoupon
  229.     {
  230.         $this->checkUser $checkUser;
  231.         return $this;
  232.     }
  233.     /**
  234.      * @return boolean
  235.      */
  236.     public function getCheckUser()
  237.     {
  238.         return $this->checkUser;
  239.     }
  240.     /**
  241.      * Set discount
  242.      *
  243.      * @param float $discount
  244.      *
  245.      * @return SalesManagoCoupon
  246.      */
  247.     public function setDiscount($discount)
  248.     {
  249.         $this->discount $discount;
  250.         return $this;
  251.     }
  252.     /**
  253.      * Get discount
  254.      *
  255.      * @return float
  256.      */
  257.     public function getDiscount()
  258.     {
  259.         return $this->discount;
  260.     }
  261.     /**
  262.      * Set actionNumber
  263.      *
  264.      * @param string $actionNumber
  265.      *
  266.      * @return SalesManagoCoupon
  267.      */
  268.     public function setActionNumber($actionNumber)
  269.     {
  270.         $this->actionNumber $actionNumber;
  271.         return $this;
  272.     }
  273.     /**
  274.      * Get actionNumber
  275.      *
  276.      * @return string
  277.      */
  278.     public function getActionNumber()
  279.     {
  280.         return $this->actionNumber;
  281.     }
  282.     /**
  283.      * Set fromSource
  284.      *
  285.      * @param string $fromSource
  286.      *
  287.      * @return SalesManagoCoupon
  288.      */
  289.     public function setFromSource($fromSource)
  290.     {
  291.         $this->fromSource $fromSource;
  292.         return $this;
  293.     }
  294.     /**
  295.      * Get fromSource
  296.      *
  297.      * @return string
  298.      */
  299.     public function getFromSource()
  300.     {
  301.         return $this->fromSource;
  302.     }
  303.     /**
  304.      * Set campaign
  305.      *
  306.      * @param string $campaign
  307.      *
  308.      * @return SalesManagoCoupon
  309.      */
  310.     public function setCampaign($campaign)
  311.     {
  312.         $this->campaign $campaign;
  313.         return $campaign;
  314.     }
  315.     /**
  316.      * Get campaign
  317.      *
  318.      * @return string
  319.      */
  320.     public function getCampaign()
  321.     {
  322.         return $this->campaign;
  323.     }
  324.     /**
  325.      * Set campaignChannel
  326.      *
  327.      * @param string $campaignChannel
  328.      *
  329.      * @return SalesManagoCoupon
  330.      */
  331.     public function setCampaignChannel($campaignChannel)
  332.     {
  333.         $this->campaignChannel $campaignChannel;
  334.         return $this;
  335.     }
  336.     /**
  337.      * Get campaignChannel
  338.      *
  339.      * @return string
  340.      */
  341.     public function getCampaignChannel()
  342.     {
  343.         return $this->campaignChannel;
  344.     }
  345.     /**
  346.      * Set maximumQuantityUse
  347.      *
  348.      * @param integer $maximumQuantityUse
  349.      *
  350.      * @return SalesManagoCoupon
  351.      */
  352.     public function setMaximumQuantityUse($maximumQuantityUse)
  353.     {
  354.         $this->maximumQuantityUse $maximumQuantityUse;
  355.         return $this;
  356.     }
  357.     /**
  358.      * Get maximumQuantityUse
  359.      *
  360.      * @return integer
  361.      */
  362.     public function getMaximumQuantityUse()
  363.     {
  364.         return $this->maximumQuantityUse;
  365.     }
  366.     /**
  367.      * Set couponType
  368.      *
  369.      * @param \App\Entity\Gos\CouponType $couponType
  370.      *
  371.      * @return SalesManagoCoupon
  372.      */
  373.     public function setCouponType(\App\Entity\Gos\CouponType $couponType null)
  374.     {
  375.         $this->couponType $couponType;
  376.         return $this;
  377.     }
  378.     /**
  379.      * Get couponType
  380.      *
  381.      * @return \App\Entity\Gos\CouponType
  382.      */
  383.     public function getCouponType()
  384.     {
  385.         return $this->couponType;
  386.     }
  387.     /**
  388.      * Add productVariant
  389.      *
  390.      * @param \App\Entity\Gos\ProductVariant $productVariant
  391.      *
  392.      * @return SalesManagoCoupon
  393.      */
  394.     public function addProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
  395.     {
  396.         $this->productVariant[] = $productVariant;
  397.         return $this;
  398.     }
  399.     /**
  400.      * Remove productVariant
  401.      *
  402.      * @param \App\Entity\Gos\ProductVariant $productVariant
  403.      */
  404.     public function removeProductVariant(\App\Entity\Gos\ProductVariant $productVariant)
  405.     {
  406.         $this->productVariant->removeElement($productVariant);
  407.     }
  408.     /**
  409.      * Get productVariant
  410.      *
  411.      * @return \Doctrine\Common\Collections\Collection
  412.      */
  413.     public function getProductVariant()
  414.     {
  415.         return $this->productVariant;
  416.     }
  417.     /**
  418.      * @return Collection|ProductVariantPack[]
  419.      */
  420.     public function getProductVariantPacks()
  421.     {
  422.         return $this->productVariantPacks;
  423.     }
  424.     public function addProductVariantPack(ProductVariantPack $productVariantPack): self
  425.     {
  426.         if (!$this->productVariantPacks->contains($productVariantPack)) {
  427.             $this->productVariantPacks[] = $productVariantPack;
  428.         }
  429.         return $this;
  430.     }
  431.     public function removeProductVariantPack(ProductVariantPack $productVariantPack): self
  432.     {
  433.         if ($this->productVariantPacks->contains($productVariantPack)) {
  434.             $this->productVariantPacks->removeElement($productVariantPack);
  435.         }
  436.         return $this;
  437.     }
  438.     /**
  439.      * Add gratis
  440.      *
  441.      * @param \App\Entity\Gos\ProductVariant $gratis
  442.      *
  443.      * @return SalesManagoCoupon
  444.      */
  445.     public function addGrati(\App\Entity\Gos\ProductVariant $gratis)
  446.     {
  447.         $this->gratis[] = $gratis;
  448.         return $this;
  449.     }
  450.     /**
  451.      * Remove gratis
  452.      *
  453.      * @param \App\Entity\Gos\ProductVariant $gratis
  454.      */
  455.     public function removeGrati(\App\Entity\Gos\ProductVariant $gratis)
  456.     {
  457.         $this->gratis->removeElement($gratis);
  458.     }
  459.     /**
  460.      * Get gratis
  461.      *
  462.      * @return \Doctrine\Common\Collections\ArrayCollection
  463.      */
  464.     public function getGratis()
  465.     {
  466.         return $this->gratis;
  467.     }
  468.     /**
  469.      * Set gratisPriceGross
  470.      *
  471.      * @param float $gratisPriceGross
  472.      *
  473.      * @return SalesManagoCoupon
  474.      */
  475.     public function setGratisPriceGross($gratisPriceGross)
  476.     {
  477.         $this->gratisPriceGross $gratisPriceGross;
  478.         return $this;
  479.     }
  480.     /**
  481.      * Get gratisPriceGross
  482.      *
  483.      * @return float
  484.      */
  485.     public function getGratisPriceGross()
  486.     {
  487.         return $this->gratisPriceGross;
  488.     }
  489.     /**
  490.      * Set gratisPriceNet
  491.      *
  492.      * @param float $gratisPriceNet
  493.      *
  494.      * @return SalesManagoCoupon
  495.      */
  496.     public function setGratisPriceNet($gratisPriceNet)
  497.     {
  498.         $this->gratisPriceNet $gratisPriceNet;
  499.         return $this;
  500.     }
  501.     /**
  502.      * Get gratisPriceNet
  503.      *
  504.      * @return float
  505.      */
  506.     public function getGratisPriceNet()
  507.     {
  508.         return $this->gratisPriceNet;
  509.     }
  510.     /**
  511.      * Set description
  512.      *
  513.      * @param string $description
  514.      *
  515.      * @return SalesManagoCoupon
  516.      */
  517.     public function setDescription($description)
  518.     {
  519.         $this->description $description;
  520.         return $this;
  521.     }
  522.     /**
  523.      * Get description
  524.      *
  525.      * @return string
  526.      */
  527.     public function getDescription()
  528.     {
  529.         return $this->description;
  530.     }
  531.     public function getAppliesToPack(): ?bool
  532.     {
  533.         return $this->appliesToPack;
  534.     }
  535.     public function setAppliesToPack(?bool $appliesToPack): self
  536.     {
  537.         $this->appliesToPack $appliesToPack;
  538.         return $this;
  539.     }
  540.     public function setCombinationMode(string $combinationMode CouponCombinationMode::NONE): self
  541.     {
  542.         if (!\in_array($combinationMode, [
  543.             CouponCombinationMode::NONE,
  544.             CouponCombinationMode::ALL,
  545.             CouponCombinationMode::SELECTED
  546.         ], true)) {
  547.             throw new \InvalidArgumentException("Invalid status");
  548.         }
  549.         $this->combinationMode $combinationMode;
  550.         return $this;
  551.     }
  552.     public function getCombinationMode(): string
  553.     {
  554.         return $this->combinationMode;
  555.     }
  556. }