src/Entity/Discount.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DiscountRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=DiscountRepository::class)
  9.  */
  10. class Discount
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="datetime")
  20.      */
  21.     private $start;
  22.     /**
  23.      * @ORM\Column(type="datetime")
  24.      */
  25.     private $end;
  26.     /**
  27.      * @ORM\Column(type="float")
  28.      */
  29.     private $rate;
  30.     /**
  31.      * @ORM\Column(type="integer", nullable=true)
  32.      */
  33.     private $minimum;
  34.     /**
  35.      * @ORM\Column(type="boolean")
  36.      */
  37.     private $status;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=Shop::class, inversedBy="discounts")
  40.      */
  41.     private $shop;
  42.     /**
  43.      * @ORM\Column(type="datetime")
  44.      */
  45.     private $creation_date;
  46.     /**
  47.      * @ORM\ManyToMany(targetEntity="Product", fetch="EAGER")
  48.      * @ORM\JoinTable(name="discount_products",
  49.      *      joinColumns={@ORM\JoinColumn(name="discount_id", referencedColumnName="id")},
  50.      *      inverseJoinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")}
  51.      *      )
  52.      */
  53.     private $discountProducts;
  54.     /**
  55.      * @ORM\Column(type="string", length=255)
  56.      */
  57.     private $target;
  58.     /**
  59.      * @ORM\Column(type="boolean")
  60.      */
  61.     private $isSynch;
  62.     /**
  63.      * @ORM\Column(type="boolean")
  64.      */
  65.     private $deleted 0;
  66.     public function __construct()
  67.     {
  68.         $this->discountProducts = new ArrayCollection();
  69.     }
  70.     public function getId(): ?int
  71.     {
  72.         return $this->id;
  73.     }
  74.     public function getStart(): ?\DateTimeInterface
  75.     {
  76.         return $this->start;
  77.     }
  78.     public function setStart(\DateTimeInterface $start): self
  79.     {
  80.         $this->start $start;
  81.         return $this;
  82.     }
  83.     public function getEnd(): ?\DateTimeInterface
  84.     {
  85.         return $this->end;
  86.     }
  87.     public function setEnd(\DateTimeInterface $end): self
  88.     {
  89.         $this->end $end;
  90.         return $this;
  91.     }
  92.     public function getRate(): ?float
  93.     {
  94.         return $this->rate;
  95.     }
  96.     public function setRate(float $rate): self
  97.     {
  98.         $this->rate $rate;
  99.         return $this;
  100.     }
  101.     public function isStatus(): ?bool
  102.     {
  103.         return $this->status;
  104.     }
  105.     public function setStatus(bool $status): self
  106.     {
  107.         $this->status $status;
  108.         return $this;
  109.     }
  110.     public function getShop(): ?Shop
  111.     {
  112.         return $this->shop;
  113.     }
  114.     public function setShop(?Shop $shop): self
  115.     {
  116.         $this->shop $shop;
  117.         return $this;
  118.     }
  119.     public function getCreationDate(): ?\DateTimeInterface
  120.     {
  121.         return $this->creation_date;
  122.     }
  123.     public function setCreationDate(\DateTimeInterface $creation_date): self
  124.     {
  125.         $this->creation_date $creation_date;
  126.         return $this;
  127.     }
  128.     /**
  129.      * @return Collection<int, DiscountProducts>
  130.      */
  131.     public function getDiscountProducts(): Collection
  132.     {
  133.         return $this->discountProducts;
  134.     }
  135.     public function addDiscountProduct(DiscountProducts $discountProduct): self
  136.     {
  137.         if (!$this->discountProducts->contains($discountProduct)) {
  138.             $this->discountProducts[] = $discountProduct;
  139.             $discountProduct->setDiscount($this);
  140.         }
  141.         return $this;
  142.     }
  143.     public function removeDiscountProduct(DiscountProducts $discountProduct): self
  144.     {
  145.         if ($this->discountProducts->removeElement($discountProduct)) {
  146.             // set the owning side to null (unless already changed)
  147.             if ($discountProduct->getDiscount() === $this) {
  148.                 $discountProduct->setDiscount(null);
  149.             }
  150.         }
  151.         return $this;
  152.     }
  153.     public function getMinimum(): ?int
  154.     {
  155.         return $this->minimum;
  156.     }
  157.     public function setMinimum(?int $minimum): self
  158.     {
  159.         $this->minimum $minimum;
  160.         return $this;
  161.     }
  162.     /**
  163.      * @return mixed
  164.      */
  165.     public function getTarget()
  166.     {
  167.         return $this->target;
  168.     }
  169.     /**
  170.      * @param mixed $target
  171.      */
  172.     public function setTarget($target): void
  173.     {
  174.         $this->target $target;
  175.     }
  176.     /**
  177.      * @return mixed
  178.      */
  179.     public function getisSynch()
  180.     {
  181.         return $this->isSynch;
  182.     }
  183.     /**
  184.      * @param mixed $isSynch
  185.      */
  186.     public function setisSynch($isSynch): void
  187.     {
  188.         $this->isSynch $isSynch;
  189.     }
  190.     /**
  191.      * @return mixed
  192.      */
  193.     public function getDeleted()
  194.     {
  195.         return $this->deleted;
  196.     }
  197.     /**
  198.      * @param mixed $deleted
  199.      */
  200.     public function setDeleted($deleted): void
  201.     {
  202.         $this->deleted $deleted;
  203.     }
  204. }