src/Entity/CouponUser.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CouponUserRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassCouponUserRepository::class)]
  7. class CouponUser
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\Column(nullabletrue)]
  14.     private ?bool $isActive null;
  15.     #[ORM\ManyToOne(inversedBy'coupon')]
  16.     #[ORM\JoinColumn(nullablefalse)]
  17.     private ?User $user null;
  18.     #[ORM\ManyToOne(inversedBy'couponUsers')]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private ?Offre $offre null;
  21.     #[ORM\Column(length255)]
  22.     private ?string $qrCodePath null;
  23.     #[ORM\Column]
  24.     private ?\DateTimeImmutable $createdAt null;
  25.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  26.     private ?\DateTimeInterface $dateUsed null;
  27.     #[ORM\Column(length255)]
  28.     private ?string $slug null;
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function isIsActive(): ?bool
  34.     {
  35.         return $this->isActive;
  36.     }
  37.     public function setIsActive(?bool $isActive): static
  38.     {
  39.         $this->isActive $isActive;
  40.         return $this;
  41.     }
  42.     public function getUser(): ?User
  43.     {
  44.         return $this->user;
  45.     }
  46.     public function setUser(?User $user): static
  47.     {
  48.         $this->user $user;
  49.         return $this;
  50.     }
  51.     public function getOffre(): ?Offre
  52.     {
  53.         return $this->offre;
  54.     }
  55.     public function setOffre(?Offre $offre): static
  56.     {
  57.         $this->offre $offre;
  58.         return $this;
  59.     }
  60.     public function getCreatedAt(): ?\DateTimeImmutable
  61.     {
  62.         return $this->createdAt;
  63.     }
  64.     public function setCreatedAt(\DateTimeImmutable $createdAt): static
  65.     {
  66.         $this->createdAt $createdAt;
  67.         return $this;
  68.     }
  69.     public function getDateUsed(): ?\DateTimeInterface
  70.     {
  71.         return $this->dateUsed;
  72.     }
  73.     public function setDateUsed(?\DateTimeInterface $dateUsed): ?static
  74.     {
  75.         $this->dateUsed $dateUsed;
  76.         return $this;
  77.     }
  78.     public function getQrCodePath(): ?string
  79.     {
  80.         return $this->qrCodePath;
  81.     }
  82.     public function setQrCodePath(string $qrCodePath): static
  83.     {
  84.         $this->qrCodePath $qrCodePath;
  85.         return $this;
  86.     }
  87.     public function getSlug(): ?string
  88.     {
  89.         return $this->slug;
  90.     }
  91.     public function setSlug(string $slug): static
  92.     {
  93.         $this->slug $slug;
  94.         return $this;
  95.     }
  96.     public function getExpirationDate(): \DateTimeImmutable|bool
  97.     {
  98.         $expirationDate = clone $this->createdAt// ou $this->createdAt selon votre logique
  99.         return $expirationDate->modify('+3 month');
  100.     }
  101.     public function getTypeEntity(): string
  102.     {
  103.         return 'coupon';
  104.     }
  105. }