<?phpnamespace App\Entity;use App\Repository\DiscountModelRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: DiscountModelRepository::class)]class DiscountModel{ //TODO: rajouter le lien à une section #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; #[ORM\Column(type: 'string', length: 100)] private $name; #[ORM\Column(type: 'smallint')] private $amount; #[ORM\Column(type: 'boolean')] private $isDisplayed; #[ORM\OneToMany(mappedBy: 'model', targetEntity: Discount::class)] private $discounts; #[ORM\OneToMany(mappedBy: 'discountModel', targetEntity: DocumentModel::class)] private $documentModels; #[ORM\Column(type: 'smallint', nullable: true)] private $ageMin; #[ORM\Column(type: 'smallint', nullable: true)] private $ageMax; #[ORM\Column(type: 'text')] private $label; public function __construct() { $this->discounts = new ArrayCollection(); $this->documentModels = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getAmount(): ?int { return $this->amount; } public function setAmount(int $amount): self { $this->amount = $amount; return $this; } public function getIsDisplayed(): ?bool { return $this->isDisplayed; } public function setIsDisplayed(bool $isDisplayed): self { $this->isDisplayed = $isDisplayed; return $this; } /** * @return Collection<int, Discount> */ public function getDiscounts(): Collection { return $this->discounts; } public function addDiscount(Discount $discount): self { if (!$this->discounts->contains($discount)) { $this->discounts[] = $discount; $discount->setModel($this); } return $this; } public function removeDiscount(Discount $discount): self { if ($this->discounts->removeElement($discount)) { // set the owning side to null (unless already changed) if ($discount->getModel() === $this) { $discount->setModel(null); } } return $this; } /** * @return Collection<int, DocumentModel> */ public function getDocumentModels(): Collection { return $this->documentModels; } public function addDocumentModel(DocumentModel $documentModel): self { if (!$this->documentModels->contains($documentModel)) { $this->documentModels[] = $documentModel; $documentModel->setDiscountModel($this); } return $this; } public function removeDocumentModel(DocumentModel $documentModel): self { if ($this->documentModels->removeElement($documentModel)) { // set the owning side to null (unless already changed) if ($documentModel->getDiscountModel() === $this) { $documentModel->setDiscountModel(null); } } return $this; } public function getAgeMin(): ?int { return $this->ageMin; } public function setAgeMin(?int $ageMin): self { $this->ageMin = $ageMin; return $this; } public function getAgeMax(): ?int { return $this->ageMax; } public function setAgeMax(?int $ageMax): self { $this->ageMax = $ageMax; return $this; } public function createDiscount(): Discount { $discount = new Discount(); $this->addDiscount($discount); return $discount; } public function getLabel(): ?string { return $this->label; } public function setLabel(string $label): self { $this->label = $label; return $this; }}