<?php namespace App\Entity; use App\Repository\PointTransactionBoosterRepository; use DateTimeInterface; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass=PointTransactionBoosterRepository::class) */ class PointTransactionBooster { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private ?int $id = NULL; /** * Date de début de validité du booster * * @ORM\Column(type="datetime") */ private DateTimeInterface $startDate; /** * Date de fin de validité du booster * * @ORM\Column(type="datetime") */ private DateTimeInterface $endDate; /** * Multiplicateur de points * * @ORM\Column(type="float") */ private float $multiplier = 0.1; /** * Label du booster * * @ORM\Column(type="string", length=255) * * @Assert\NotBlank */ private string $label; /** * Liste des produits associés au booster * * @ORM\ManyToMany(targetEntity=PurchaseProduct::class, inversedBy="pointTransactionBoosters") */ private Collection $purchaseProducts; public function __construct() { $this->purchaseProducts = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getStartDate(): DateTimeInterface { return $this->startDate; } public function setStartDate(DateTimeInterface $startDate): self { $this->startDate = $startDate; return $this; } public function getEndDate(): DateTimeInterface { return $this->endDate; } public function setEndDate(DateTimeInterface $endDate): self { $this->endDate = $endDate; return $this; } public function getMultiplier(): float { return $this->multiplier; } public function setMultiplier(float $multiplier): self { $this->multiplier = $multiplier; return $this; } public function getLabel(): ?string { return $this->label; } public function setLabel(string $label): self { $this->label = $label; return $this; } /** * @return Collection<int, PurchaseProduct> */ public function getPurchaseProducts(): Collection { return $this->purchaseProducts; } public function addPurchaseProduct(PurchaseProduct $purchaseProduct): self { if (!$this->purchaseProducts->contains($purchaseProduct)) { $this->purchaseProducts[] = $purchaseProduct; } return $this; } public function removePurchaseProduct(PurchaseProduct $purchaseProduct): self { $this->purchaseProducts->removeElement($purchaseProduct); return $this; } }