<?php
namespace App\Entity;
use App\Repository\DiscountRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=DiscountRepository::class)
*/
class Discount
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $start;
/**
* @ORM\Column(type="datetime")
*/
private $end;
/**
* @ORM\Column(type="float")
*/
private $rate;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $minimum;
/**
* @ORM\Column(type="boolean")
*/
private $status;
/**
* @ORM\ManyToOne(targetEntity=Shop::class, inversedBy="discounts")
*/
private $shop;
/**
* @ORM\Column(type="datetime")
*/
private $creation_date;
/**
* @ORM\ManyToMany(targetEntity="Product", fetch="EAGER")
* @ORM\JoinTable(name="discount_products",
* joinColumns={@ORM\JoinColumn(name="discount_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="product_id", referencedColumnName="id")}
* )
*/
private $discountProducts;
/**
* @ORM\Column(type="string", length=255)
*/
private $target;
/**
* @ORM\Column(type="boolean")
*/
private $isSynch;
/**
* @ORM\Column(type="boolean")
*/
private $deleted = 0;
public function __construct()
{
$this->discountProducts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getStart(): ?\DateTimeInterface
{
return $this->start;
}
public function setStart(\DateTimeInterface $start): self
{
$this->start = $start;
return $this;
}
public function getEnd(): ?\DateTimeInterface
{
return $this->end;
}
public function setEnd(\DateTimeInterface $end): self
{
$this->end = $end;
return $this;
}
public function getRate(): ?float
{
return $this->rate;
}
public function setRate(float $rate): self
{
$this->rate = $rate;
return $this;
}
public function isStatus(): ?bool
{
return $this->status;
}
public function setStatus(bool $status): self
{
$this->status = $status;
return $this;
}
public function getShop(): ?Shop
{
return $this->shop;
}
public function setShop(?Shop $shop): self
{
$this->shop = $shop;
return $this;
}
public function getCreationDate(): ?\DateTimeInterface
{
return $this->creation_date;
}
public function setCreationDate(\DateTimeInterface $creation_date): self
{
$this->creation_date = $creation_date;
return $this;
}
/**
* @return Collection<int, DiscountProducts>
*/
public function getDiscountProducts(): Collection
{
return $this->discountProducts;
}
public function addDiscountProduct(DiscountProducts $discountProduct): self
{
if (!$this->discountProducts->contains($discountProduct)) {
$this->discountProducts[] = $discountProduct;
$discountProduct->setDiscount($this);
}
return $this;
}
public function removeDiscountProduct(DiscountProducts $discountProduct): self
{
if ($this->discountProducts->removeElement($discountProduct)) {
// set the owning side to null (unless already changed)
if ($discountProduct->getDiscount() === $this) {
$discountProduct->setDiscount(null);
}
}
return $this;
}
public function getMinimum(): ?int
{
return $this->minimum;
}
public function setMinimum(?int $minimum): self
{
$this->minimum = $minimum;
return $this;
}
/**
* @return mixed
*/
public function getTarget()
{
return $this->target;
}
/**
* @param mixed $target
*/
public function setTarget($target): void
{
$this->target = $target;
}
/**
* @return mixed
*/
public function getisSynch()
{
return $this->isSynch;
}
/**
* @param mixed $isSynch
*/
public function setisSynch($isSynch): void
{
$this->isSynch = $isSynch;
}
/**
* @return mixed
*/
public function getDeleted()
{
return $this->deleted;
}
/**
* @param mixed $deleted
*/
public function setDeleted($deleted): void
{
$this->deleted = $deleted;
}
}