<?phpnamespace App\Entity;use App\Repository\DiscountRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * @ORM\Entity(repositoryClass=DiscountRepository::class) */class Discount{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="float") */ private $percentage; /** * @ORM\Column(type="string", length=255) */ private $type; /** * @ORM\Column(type="integer", nullable=true) */ private $minimum; /** * @ORM\Column(type="integer", nullable=true) */ private $maximum; /** * @ORM\Column(type="boolean", options={"default":"1"}) */ private $statut = true; /** * @ORM\OneToMany(targetEntity=Order::class, mappedBy="discount") */ private $orders; /** * @ORM\Column(type="datetime_immutable") * @Gedmo\Timestampable(on="create") */ private $created_at; /** * @ORM\Column(type="datetime_immutable") * @Gedmo\Timestampable(on="update") */ private $updated_at; public function __construct() { $this->orders = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getPercentage(): ?float { return $this->percentage; } public function setPercentage(float $percentage): self { $this->percentage = $percentage; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): self { $this->type = $type; return $this; } public function getMinimum(): ?string { return $this->minimum; } public function setMinimum(string $minimum): self { $this->minimum = $minimum; return $this; } public function getMaximum(): ?string { return $this->maximum; } public function setMaximum(string $maximum): self { $this->maximum = $maximum; return $this; } public function isStatut(): ?bool { return $this->statut; } public function setStatut(bool $statut): self { $this->statut = $statut; return $this; } /** * @return Collection<int, Order> */ public function getOrders(): Collection { return $this->orders; } public function addOrder(Order $order): self { if (!$this->orders->contains($order)) { $this->orders[] = $order; $order->setDiscount($this); } return $this; } public function removeOrder(Order $order): self { if ($this->orders->removeElement($order)) { // set the owning side to null (unless already changed) if ($order->getDiscount() === $this) { $order->setDiscount(null); } } return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->created_at; } public function setCreatedAt(\DateTimeImmutable $created_at): self { $this->created_at = $created_at; return $this; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updated_at; } public function setUpdatedAt(\DateTimeImmutable $updated_at): self { $this->updated_at = $updated_at; return $this; }}