src/Entity/ProduitPromotionHistory.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Entity\Produit;
  5. use App\Entity\Promotion;
  6. /**
  7.  * Historique des promotions appliquées à un produit.
  8.  *
  9.  * @ORM\Entity(repositoryClass="App\Repository\ProduitPromotionHistoryRepository")
  10.  * @ORM\Table(name="produit_promotion_history", indexes={
  11.  *   @ORM\Index(columns={"started_at"}),
  12.  *   @ORM\Index(columns={"ended_at"})
  13.  * })
  14.  */
  15. class ProduitPromotionHistory
  16. {
  17.     /**
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue
  20.      * @ORM\Column(type="integer")
  21.      */
  22.     private int $id;
  23.    /**
  24.      * Produit concerné.
  25.      * @ORM\ManyToOne(
  26.      *     targetEntity=Produit::class,
  27.      *     inversedBy="promotionHistories"
  28.      * )
  29.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  30.      */
  31.     private ?Produit $product null;
  32.     /**
  33.      * Promotion appliquée.
  34.      * @ORM\ManyToOne(targetEntity=Promotion::class)
  35.      * @ORM\JoinColumn(nullable=false)
  36.      */
  37.     private Promotion $promotion;
  38.     /**
  39.      * Date/heure d’application.
  40.      * @ORM\Column(type="datetime_immutable")
  41.      */
  42.     private \DateTimeImmutable $startedAt;
  43.     /**
  44.      * Date/heure de fin (null si en cours).
  45.      * @ORM\Column(type="datetime_immutable", nullable=true)
  46.      */
  47.     private ?\DateTimeImmutable $endedAt null;
  48.     /**
  49.      * Opérateur ayant appliqué la promo (identifiant lisible).
  50.      * @ORM\Column(type="string", length=100, nullable=true)
  51.      */
  52.     private ?string $startedBy null;
  53.     /**
  54.      * Opérateur ayant mis fin à la promo.
  55.      * @ORM\Column(type="string", length=100, nullable=true)
  56.      */
  57.     private ?string $endedBy null;
  58.     /**
  59.      * Motif de fin.
  60.      * @ORM\Column(type="string", length=120, nullable=true)
  61.      */
  62.     private ?string $endReason null;
  63.     /** @ORM\Column(type="text", nullable=true) */
  64.     private ?string $endNote null;
  65.     
  66.     public function getId(): int
  67.     {
  68.         return $this->id;
  69.     }
  70.     public function getProduct(): Produit
  71.     {
  72.         return $this->product;
  73.     }
  74.     public function setProduct(Produit $product): self
  75.     {
  76.         $this->product $product;
  77.         return $this;
  78.     }
  79.     public function getPromotion(): Promotion
  80.     {
  81.         return $this->promotion;
  82.     }
  83.     public function setPromotion(Promotion $promotion): self
  84.     {
  85.         $this->promotion $promotion;
  86.         return $this;
  87.     }
  88.     public function getStartedAt(): \DateTimeImmutable
  89.     {
  90.         return $this->startedAt;
  91.     }
  92.     public function setStartedAt(\DateTimeImmutable $startedAt): self
  93.     {
  94.         $this->startedAt $startedAt;
  95.         return $this;
  96.     }
  97.     public function getEndedAt(): ?\DateTimeImmutable
  98.     {
  99.         return $this->endedAt;
  100.     }
  101.     public function setEndedAt(?\DateTimeImmutable $endedAt): self
  102.     {
  103.         $this->endedAt $endedAt;
  104.         return $this;
  105.     }
  106.     public function getStartedBy(): ?string
  107.     {
  108.         return $this->startedBy;
  109.     }
  110.     public function setStartedBy(?string $startedBy): self
  111.     {
  112.         $this->startedBy $startedBy;
  113.         return $this;
  114.     }
  115.     public function getEndedBy(): ?string
  116.     {
  117.         return $this->endedBy;
  118.     }
  119.     public function setEndedBy(?string $endedBy): self
  120.     {
  121.         $this->endedBy $endedBy;
  122.         return $this;
  123.     }
  124.     public function getEndReason(): ?string
  125.     {
  126.         return $this->endReason;
  127.     }
  128.     public function setEndReason(?string $endReason): self
  129.     {
  130.         $this->endReason $endReason;
  131.         return $this;
  132.     }
  133.     public function getEndNote(): ?string { return $this->endNote; }
  134.     public function setEndNote(?string $endNote): self $this->endNote $endNote; return $this; }
  135. }