src/Entity/UserPromotionHistory.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Entity\User;
  5. use App\Entity\Promotion;
  6. /**
  7.  * Historique des codes promotionnels appliqués à un client.
  8.  *
  9.  * @ORM\Entity(repositoryClass="App\Repository\UserPromotionHistoryRepository")
  10.  * @ORM\Table(
  11.  *     name="user_promotion_history",
  12.  *     indexes={
  13.  *         @ORM\Index(columns={"started_at"}),
  14.  *         @ORM\Index(columns={"ended_at"})
  15.  *     }
  16.  * )
  17.  */
  18. class UserPromotionHistory
  19. {
  20.     /**
  21.      * @ORM\Id
  22.      * @ORM\GeneratedValue
  23.      * @ORM\Column(type="integer")
  24.      */
  25.     private int $id;
  26.     /**
  27.      * Client concerné.
  28.      * @ORM\ManyToOne(targetEntity=User::class)
  29.      * @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
  30.      */
  31.     private User $user;
  32.     /**
  33.      * Promotion appliquée.
  34.      * @ORM\ManyToOne(targetEntity=Promotion::class)
  35.      * @ORM\JoinColumn(nullable=false)
  36.      */
  37.     private Promotion $promotion;
  38.     /**
  39.      * Date d’application.
  40.      * @ORM\Column(type="datetime_immutable")
  41.      */
  42.     private \DateTimeImmutable $startedAt;
  43.     /**
  44.      * Date de fin (null si encore en cours).
  45.      * @ORM\Column(type="datetime_immutable", nullable=true)
  46.      */
  47.     private ?\DateTimeImmutable $endedAt null;
  48.     /**
  49.      * Opérateur ayant appliqué le code.
  50.      * @ORM\Column(type="string", length=100, nullable=true)
  51.      */
  52.     private ?string $startedBy null;
  53.     /**
  54.      * Opérateur ayant mis fin au code.
  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.     /**
  64.      * Note optionnelle.
  65.      * @ORM\Column(type="text", nullable=true)
  66.      */
  67.     private ?string $endNote null;
  68.     /* ---------- GETTERS / SETTERS ---------- */
  69.     public function getId(): int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getUser(): User
  74.     {
  75.         return $this->user;
  76.     }
  77.     public function setUser(User $user): self
  78.     {
  79.         $this->user $user;
  80.         return $this;
  81.     }
  82.     public function getPromotion(): Promotion
  83.     {
  84.         return $this->promotion;
  85.     }
  86.     public function setPromotion(Promotion $promotion): self
  87.     {
  88.         $this->promotion $promotion;
  89.         return $this;
  90.     }
  91.     public function getStartedAt(): \DateTimeImmutable
  92.     {
  93.         return $this->startedAt;
  94.     }
  95.     public function setStartedAt(\DateTimeImmutable $startedAt): self
  96.     {
  97.         $this->startedAt $startedAt;
  98.         return $this;
  99.     }
  100.     public function getEndedAt(): ?\DateTimeImmutable
  101.     {
  102.         return $this->endedAt;
  103.     }
  104.     public function setEndedAt(?\DateTimeImmutable $endedAt): self
  105.     {
  106.         $this->endedAt $endedAt;
  107.         return $this;
  108.     }
  109.     public function getStartedBy(): ?string
  110.     {
  111.         return $this->startedBy;
  112.     }
  113.     public function setStartedBy(?string $startedBy): self
  114.     {
  115.         $this->startedBy $startedBy;
  116.         return $this;
  117.     }
  118.     public function getEndedBy(): ?string
  119.     {
  120.         return $this->endedBy;
  121.     }
  122.     public function setEndedBy(?string $endedBy): self
  123.     {
  124.         $this->endedBy $endedBy;
  125.         return $this;
  126.     }
  127.     public function getEndReason(): ?string
  128.     {
  129.         return $this->endReason;
  130.     }
  131.     public function setEndReason(?string $endReason): self
  132.     {
  133.         $this->endReason $endReason;
  134.         return $this;
  135.     }
  136.     public function getEndNote(): ?string
  137.     {
  138.         return $this->endNote;
  139.     }
  140.     public function setEndNote(?string $endNote): self
  141.     {
  142.         $this->endNote $endNote;
  143.         return $this;
  144.     }
  145. }