src/Entity/PointTransactionBooster.php line 15

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\PointTransactionBoosterRepository;
  4.     use DateTimeInterface;
  5.     use Doctrine\Common\Collections\ArrayCollection;
  6.     use Doctrine\Common\Collections\Collection;
  7.     use Doctrine\ORM\Mapping as ORM;
  8.     use Symfony\Component\Validator\Constraints as Assert;
  9.     /**
  10.      * @ORM\Entity(repositoryClass=PointTransactionBoosterRepository::class)
  11.      */
  12.     class PointTransactionBooster
  13.     {
  14.         /**
  15.          * @ORM\Id
  16.          * @ORM\GeneratedValue
  17.          * @ORM\Column(type="integer")
  18.          */
  19.         private ?int $id NULL;
  20.         /**
  21.          * Date de début de validité du booster
  22.          *
  23.          * @ORM\Column(type="datetime")
  24.          */
  25.         private DateTimeInterface $startDate;
  26.         /**
  27.          * Date de fin de validité du booster
  28.          *
  29.          * @ORM\Column(type="datetime")
  30.          */
  31.         private DateTimeInterface $endDate;
  32.         /**
  33.          * Multiplicateur de points
  34.          *
  35.          * @ORM\Column(type="float")
  36.          */
  37.         private float $multiplier 0.1;
  38.         /**
  39.          * Label du booster
  40.          *
  41.          * @ORM\Column(type="string", length=255)
  42.          *
  43.          * @Assert\NotBlank
  44.          */
  45.         private string $label;
  46.         /**
  47.          * Liste des produits associés au booster
  48.          *
  49.          * @ORM\ManyToMany(targetEntity=PurchaseProduct::class, inversedBy="pointTransactionBoosters")
  50.          */
  51.         private Collection $purchaseProducts;
  52.         public function __construct()
  53.         {
  54.             $this->purchaseProducts = new ArrayCollection();
  55.         }
  56.         public function getId(): ?int
  57.         {
  58.             return $this->id;
  59.         }
  60.         public function getStartDate(): DateTimeInterface
  61.         {
  62.             return $this->startDate;
  63.         }
  64.         public function setStartDate(DateTimeInterface $startDate): self
  65.         {
  66.             $this->startDate $startDate;
  67.             return $this;
  68.         }
  69.         public function getEndDate(): DateTimeInterface
  70.         {
  71.             return $this->endDate;
  72.         }
  73.         public function setEndDate(DateTimeInterface $endDate): self
  74.         {
  75.             $this->endDate $endDate;
  76.             return $this;
  77.         }
  78.         public function getMultiplier(): float
  79.         {
  80.             return $this->multiplier;
  81.         }
  82.         public function setMultiplier(float $multiplier): self
  83.         {
  84.             $this->multiplier $multiplier;
  85.             return $this;
  86.         }
  87.         public function getLabel(): ?string
  88.         {
  89.             return $this->label;
  90.         }
  91.         public function setLabel(string $label): self
  92.         {
  93.             $this->label $label;
  94.             return $this;
  95.         }
  96.         /**
  97.          * @return Collection<int, PurchaseProduct>
  98.          */
  99.         public function getPurchaseProducts(): Collection
  100.         {
  101.             return $this->purchaseProducts;
  102.         }
  103.         public function addPurchaseProduct(PurchaseProduct $purchaseProduct): self
  104.         {
  105.             if (!$this->purchaseProducts->contains($purchaseProduct)) {
  106.                 $this->purchaseProducts[] = $purchaseProduct;
  107.             }
  108.             return $this;
  109.         }
  110.         public function removePurchaseProduct(PurchaseProduct $purchaseProduct): self
  111.         {
  112.             $this->purchaseProducts->removeElement($purchaseProduct);
  113.             return $this;
  114.         }
  115.     }