<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\User;
use App\Entity\Promotion;
/**
* Historique des codes promotionnels appliqués à un client.
*
* @ORM\Entity(repositoryClass="App\Repository\UserPromotionHistoryRepository")
* @ORM\Table(
* name="user_promotion_history",
* indexes={
* @ORM\Index(columns={"started_at"}),
* @ORM\Index(columns={"ended_at"})
* }
* )
*/
class UserPromotionHistory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private int $id;
/**
* Client concerné.
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false, onDelete="CASCADE")
*/
private User $user;
/**
* Promotion appliquée.
* @ORM\ManyToOne(targetEntity=Promotion::class)
* @ORM\JoinColumn(nullable=false)
*/
private Promotion $promotion;
/**
* Date d’application.
* @ORM\Column(type="datetime_immutable")
*/
private \DateTimeImmutable $startedAt;
/**
* Date de fin (null si encore en cours).
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private ?\DateTimeImmutable $endedAt = null;
/**
* Opérateur ayant appliqué le code.
* @ORM\Column(type="string", length=100, nullable=true)
*/
private ?string $startedBy = null;
/**
* Opérateur ayant mis fin au code.
* @ORM\Column(type="string", length=100, nullable=true)
*/
private ?string $endedBy = null;
/**
* Motif de fin.
* @ORM\Column(type="string", length=120, nullable=true)
*/
private ?string $endReason = null;
/**
* Note optionnelle.
* @ORM\Column(type="text", nullable=true)
*/
private ?string $endNote = null;
/* ---------- GETTERS / SETTERS ---------- */
public function getId(): int
{
return $this->id;
}
public function getUser(): User
{
return $this->user;
}
public function setUser(User $user): self
{
$this->user = $user;
return $this;
}
public function getPromotion(): Promotion
{
return $this->promotion;
}
public function setPromotion(Promotion $promotion): self
{
$this->promotion = $promotion;
return $this;
}
public function getStartedAt(): \DateTimeImmutable
{
return $this->startedAt;
}
public function setStartedAt(\DateTimeImmutable $startedAt): self
{
$this->startedAt = $startedAt;
return $this;
}
public function getEndedAt(): ?\DateTimeImmutable
{
return $this->endedAt;
}
public function setEndedAt(?\DateTimeImmutable $endedAt): self
{
$this->endedAt = $endedAt;
return $this;
}
public function getStartedBy(): ?string
{
return $this->startedBy;
}
public function setStartedBy(?string $startedBy): self
{
$this->startedBy = $startedBy;
return $this;
}
public function getEndedBy(): ?string
{
return $this->endedBy;
}
public function setEndedBy(?string $endedBy): self
{
$this->endedBy = $endedBy;
return $this;
}
public function getEndReason(): ?string
{
return $this->endReason;
}
public function setEndReason(?string $endReason): self
{
$this->endReason = $endReason;
return $this;
}
public function getEndNote(): ?string
{
return $this->endNote;
}
public function setEndNote(?string $endNote): self
{
$this->endNote = $endNote;
return $this;
}
}