src/Entity/LotCoupon.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LotCouponRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClass: LotCouponRepository::class)]
  9. class LotCoupon
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id = null;
  15.     #[ORM\Column(length: 255, nullable: true)]
  16.     private ?string $libelle = null;
  17.     #[ORM\Column(nullable: true)]
  18.     private ?int $quantiteInitiale = null;
  19.     #[ORM\Column(nullable: true)]
  20.     private ?int $seuilAlerte = null;
  21.     #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
  22.     private ?\DateTimeInterface $dateGeneration = null; // Déplacé ici !
  23.     #[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
  24.     private ?\DateTimeInterface $dateExpiration = null; // Déplacé ici !
  25.     #[ORM\ManyToOne(inversedBy: 'lotCoupons')]
  26.     private ?Evenement $evenement = null;
  27.     #[ORM\OneToMany(mappedBy: 'lotCoupon', targetEntity: Coupon::class,cascade: ['persist','remove'])]
  28.     private Collection $coupons;
  29.     #[ORM\Column(nullable: true)]
  30.     private ?int $stock = null;
  31.     #[ORM\Column(nullable: true)]
  32.     private ?float $pourcentage = null;
  33.     #[ORM\Column(nullable: true)]
  34.     private ?bool $isActif = null;
  35.     public function __construct()
  36.     {
  37.         $this->coupons = new ArrayCollection();
  38.     }
  39.     public function getId(): ?int
  40.     {
  41.         return $this->id;
  42.     }
  43.     public function getLibelle(): ?string
  44.     {
  45.         return $this->libelle;
  46.     }
  47.     public function setLibelle(?string $libelle): self
  48.     {
  49.         $this->libelle = $libelle;
  50.         return $this;
  51.     }
  52.     public function getQuantiteInitiale(): ?int
  53.     {
  54.         return $this->quantiteInitiale;
  55.     }
  56.     public function setQuantiteInitiale(?int $quantiteInitiale): self
  57.     {
  58.         $this->quantiteInitiale = $quantiteInitiale;
  59.         return $this;
  60.     }
  61.     public function getSeuilAlerte(): ?int
  62.     {
  63.         return $this->seuilAlerte;
  64.     }
  65.     public function setSeuilAlerte(?int $seuilAlerte): self
  66.     {
  67.         $this->seuilAlerte = $seuilAlerte;
  68.         return $this;
  69.     }
  70.     public function getEvenement(): ?Evenement
  71.     {
  72.         return $this->evenement;
  73.     }
  74.     public function setEvenement(?Evenement $evenement): self
  75.     {
  76.         $this->evenement = $evenement;
  77.         return $this;
  78.     }
  79.     public function getDateGeneration(): ?\DateTimeInterface { return $this->dateGeneration; }
  80.     public function setDateGeneration(?\DateTimeInterface $dateGeneration): self { $this->dateGeneration = $dateGeneration; return $this; }
  81.     public function getDateExpiration(): ?\DateTimeInterface { return $this->dateExpiration; }
  82.     public function setDateExpiration(?\DateTimeInterface $dateExpiration): self { $this->dateExpiration = $dateExpiration; return $this; }
  83.     /**
  84.      * @return Collection<int, Coupon>
  85.      */
  86.     public function getCoupons(): Collection
  87.     {
  88.         return $this->coupons;
  89.     }
  90.     public function addCoupon(Coupon $coupon): self
  91.     {
  92.         if (!$this->coupons->contains($coupon)) {
  93.             $this->coupons->add($coupon);
  94.             $coupon->setLotCoupon($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeCoupon(Coupon $coupon): self
  99.     {
  100.         if ($this->coupons->removeElement($coupon)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($coupon->getLotCoupon() === $this) {
  103.                 $coupon->setLotCoupon(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     public function getStock(): ?int
  109.     {
  110.         return $this->stock;
  111.     }
  112.     public function setStock(?int $stock): self
  113.     {
  114.         $this->stock = $stock;
  115.         return $this;
  116.     }
  117.     public function getPourcentage(): ?float
  118.     {
  119.         return $this->pourcentage;
  120.     }
  121.     public function setPourcentage(?float $pourcentage): self
  122.     {
  123.         $this->pourcentage = $pourcentage;
  124.         return $this;
  125.     }
  126.     public function isIsActif(): ?bool
  127.     {
  128.         return $this->isActif;
  129.     }
  130.     public function setIsActif(?bool $isActif): self
  131.     {
  132.         $this->isActif = $isActif;
  133.         return $this;
  134.     }
  135. }